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

Dustin J. Mitchell dustin at v.igoro.us
Sun Nov 5 16:59:36 CET 2006

Kent Johnson wrote:
> Dustin J. Mitchell wrote:
>> Asrarahmed Kadri wrote:
>>> "C:\Python24\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py",
>>> line 310, in RunScript
>>>     exec codeObject in __main__.__dict__
>>>   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
>> This tells you everything you need to know right here.
>> What version of Python are you using?  I know traceback existed at least in
>> 2.3.  Might be time to consider an upgrade.
> If traceback was not a valid module name the import would raise 
> ImportError, not NameError.
> Something strange is going on here; have you shown us all the code?

Python caches the text of programs, and will show that in later tracebacks.
Try restarting your IDE and running the script again, or look on line 38 of
my_version_datecheck.py -- I bet it doesn't say "import traceback".


More information about the Tutor mailing list