File Creation Not Working In A Thread Class?

Gary Herron gherron at islandtraining.com
Sun May 11 13:51:34 EDT 2008


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



> where fileName is defined before the line it's used in.  It works fine 
> when I use it outside a thread class.
>
> When I put the same line in a thread class, it no longer works, and I get 
> an error:
>
> IOError: [Errno 2] no such file u'fileName'
>
> Are threads not allowed to create files?
> --
> http://mail.python.org/mailman/listinfo/python-list
>   




More information about the Python-list mailing list