[Tutor] Help me to debug this script .. I tried but ....

Danny Yoo dyoo at hkn.eecs.berkeley.edu
Sun Nov 5 20:30:52 CET 2006


On Sun, 5 Nov 2006, Asrarahmed Kadri wrote:

> When I am running the script from the command line, its working fine but
> when I am trying to run from Pythonwin, its giving me error.
>
> Can anyone explain the reason?

Hi Asrarahmed,


Did you see Kent's reply?  He mentioned:

>> Something strange is going on here; have you shown us all the code?


I agree with Kent.  I suspect something very funky is going on here, 
especially since the error message says that you're doing an 'import 
traceback' within a function called dateCheck().  That's highly unusual: 
people usually put their imports at the top level.  The error message 
that's coming out has hints of weirdness in it:


>> >>   File "C:\project stuff-programs\Scriptdate.py", line 18, in ?
>> >>     t1 = my_version_datecheck.dateCheck(dt1,0)
>> >>   File "my_version_datecheck.py", line 38, in dateCheck
>> >>     import traceback
>> >> NameError: global name 'traceback' is not defined

Why would the code try to do an import on line 38?  That's way deep in the 
middle of your program.  Very strange.  The most likely thing that's going 
on, given the information so far, is that the line numbers are wrong, and 
that 'my_version_datecheck' has been changed while the program is running.


We don't have enough information to duplicate your error yet. So please 
show us your 'my_version_datecheck.py'.  Otherwise, we really can't do 
much else except guess at the problem.


More information about the Tutor mailing list