By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,880 Members | 2,279 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,880 IT Pros & Developers. It's quick & easy.

Syntax error in ".py" file and globals variable values not available.

P: n/a

I have a strange behaviour of python with pdb and import statement.
Here is the example code :

import my2


I intentionnaly put a syntax error in file

If I run "python -i" and run pdb I got :
NameError: name 'toto' is not defined
>>import pdb
>>print a

If I run "python -i" and run pdb I got :
NameError: name 'toto' is not defined
>>import pdb
>>print a

Why can't I get access to variable a in pdb when the process generating
the error came from an import statement ?

With python 2.3.5, it works fine and in the two cases I get the correct
value of 5 for variable "a".
with python 2.43,2.5.1,2.5.2, it doesn't work and I get "None" value for
variable a.

Somebody can explain me this behaviour ?
Boutillier Alexis
Methodology engineer

Arteris SA
The Network-on-Chip Company TM

6 par Ariane Immeuble Mercure
78284 Guyancourt Cedex
Office: (+33) 1 61 37 38 71
Fax: (+33) 1 61 37 38 41
Aug 27 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.