[Tutor] Why does it display traceback info here and not there?
Alan Gauld
alan.gauld at btinternet.com
Sat May 30 21:45:29 CEST 2009
"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/
More information about the Tutor
mailing list