open() error ---- what am I missing?

Eric Torstenson torstenson at no-spam.oti-hsv.com
Mon Mar 4 12:31:46 EST 2002


This is really frustrating for me, and was hoping someone could point me in
the right direction.

I have a class that I use to generate a log. It handles opens, closes and
logging to the file.

I have another class which does a lot of other stuff, and occassionally
writes messages to the log.

The program has worked fine, but when after adding a couple of details (none
of which affected the log), I now get:
    Traceback (most recent call last):
      File "pLog.py", line 10, in __init__
        self.logInit(sFilename)
      File "pLog.py", line 14, in logInit
        self.fLog=open(filename, mode='w')
    IOError: invalid argument: w

I have read that you can hide built ins by doing:
    from some_file import *
if some_file an instance of open() exists in the *

but I don't have anything like that in my code.

The weirder thing, is that I can use the log in other scripts. I have even
copied the imports to the test script, and it continues to run without
error.

Does anyone know how to determine what is hiding the builting open() routine
(file() does the same), or how to explicitly call the builtin.open()
command? I had trouble with this at the very beginning (I'm still very new
to python), but I usually was able to get it worked out.

thanks,

eric






More information about the Python-list mailing list