[Tutor] Why does it display traceback info here and not there?

xbmuncher xboxmuncher at gmail.com
Sun May 31 07:55:53 CEST 2009


Well you're right about the paths...
print(os.getcwd())    outputs
when run from notepad++:
c:\program files\Notepad++

when double clicked:
actual directory path

I'd like to use notepad++ to execute the scripts I edit, is there a way to
solve this problem?

On Sat, May 30, 2009 at 3:45 PM, Alan Gauld <alan.gauld at btinternet.com>wrote:

>
> "xbmuncher" <xboxmuncher at gmail.com> wrote
>
>  Traceback (most recent call last):
>> File "C:\path to file\script.py", line 1, in
>> <module>
>>   h = open('file2.dat', 'rb')
>> File "C:\Python30\lib\io.py", line 278, in __new__
>>   return open(*(args, **kwargs)
>> File "C:\Python30\lib\io.py", line 222, in open
>>   closefd)
>> File "C:\Python30\lib\io.py", line 619, in __init__
>>
>>
> You don't have the full traceback here so we can't see
> the actual error condition but I suspect its a problem with
> paths. Python probably can't find the file because its
> looking in the wrong place. Does it worik if you give the
> fuill path to the file?
>
>
>  The WEIRD thing is, is that I can double click the same unchanged
>> script.py
>> file and it will run from the same program python.exe and it will display
>> this output:
>> \xb7\lots of these types of \xb codes
>> Press ENTER to exit
>>
>> So my question is, why does it have different output run from the same
>> python.exe program when the script remains the same.
>>
>
> Probably Python is being called with the editors startup folder
> so cannot find your file.
>
>  Maybe I can turn off traceback info?
>>
>
> You could but its not wise, the traceback means there is an error
> so turning the messages off won't help your program to run,
> you just won't get any clues as to why its not working!
>
> HTH,
>
> --
> Alan Gauld
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090531/20e53d2b/attachment.htm>


More information about the Tutor mailing list