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

xbmuncher xboxmuncher at gmail.com
Sat May 30 16:20:38 CEST 2009


I have a script called: script.py and here are the contents:

h = open('file2.dat', 'rb')
data = h.read(1120)
h.close()
print(data)

input("Press ENTER to exit")


I am editing it in Notepad++ and I set it up so I can run in on python.exe
(I have python30) from the program, it sends these parameters:
C:\Python30\python.exe pathToFile\folder\script.py

Well when I run the script via this method, the screen flashes and quickly
disappears, so there must be some kind of error. I used screen capture to
try to capture what happened so I can read the message, this is what I got:

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__


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. I'd like to called it
to run from notepad++ out of convenience just as it runs when I double click
on it.. but i'm getting different behavior and I dont know why...
Maybe I can turn off traceback info?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090530/b3c2cc5d/attachment.htm>


More information about the Tutor mailing list