File Creation Not Working In A Thread Class?
bc90021
python at bc90021.net
Sun May 11 13:59:13 EDT 2008
On Sun, 11 May 2008 10:51:34 -0700, Gary Herron wrote:
> bc90021 wrote:
>> Hi All,
>>
>> Thanks in advance for any and all help!
>>
>> I have this code:
>>
>> g = open(fileName, 'a')
>>
>>
> I don't believe you. I think you have something like
>
> g = open('fileName', 'a')
>
> instead of (as you claim)
>
> g = open(fileName, 'a')
>
> Do you see the difference?
>
> Develop the skill of reading the error messages *very* carefully. Your
> error says there is no file named "fileName", and if you think about
> what's on your disk, I'll bet you won't find a file whose name is
> "fileName".
>
>
> Gary Herron
>
Gary,
I can assure you that that's not the case. (Of course, you're free to
believe me or not believe me at your convenience.) You are right that I
don't have that file on the disk - it is supposed to be created with the
"open" line! It works *perfectly* outside the class the inherits from
threading.Thread; inside the threading.Thread class it does NOT create
the file, whether I use g = open(fileName, 'a') or g = open (fileName,
'w'). Hence my obvious confusion.
More information about the Python-list
mailing list