Menu

#757 Log file location not set consistently on Windows

closed-fixed
nobody
General (277)
5
2008-07-14
2008-07-02
No

I noticed that if I start interwiki.py with the command "interwiki.py -log ..." on Windows XP, its log file interwiki.log is created in the pywikipedia root directory, e.g. C:\svn\pywikipedia\interwiki.log.

However, if I use the command "python interwiki.py -log ...", the log file is properly created in the logs subdirectory, e.g. C:\svn\pywikipedia\logs\interwiki.log.

This is caused by the fact that sys.argv[0] is different depending on how you start interwiki.py: "interwiki.py" sets sys.argv[0] to "C:\svn\pywikipedia\interwiki.py", while "python interwiki.py" sets it to "interwiki.py" without the path. The function calledModuleName() in wikipedia.py uses sys.argv[0] to determine the module name, and setLogfileStatus() uses the module name to construct the log file name.

Can we use os.path.basename() in calledModuleName() to normalize the module name, or would this break something else?

Discussion

  • Mikko Silvonen

    Mikko Silvonen - 2008-07-02

    Log file location fix for wikipedia.py r5664

     
  • Russell Blau

    Russell Blau - 2008-07-14
    • status: open --> closed-fixed
     
  • Russell Blau

    Russell Blau - 2008-07-14

    Logged In: YES
    user_id=855050
    Originator: NO

    fixed in r5717

     

Log in to post a comment.