very strange syntax errors

John J. Lee jjl at pobox.com
Fri Mar 30 20:11:24 EDT 2007


hg <hg at nospam.org> writes:

> Hi,
> 
> I'v been facing some very strange errors lately:
> 
> one example:
> 
> def __init__(self):
> ....
>         import my_info
>         some_text = my_info.T_SOME_TEXT
>                                       ^ syntax error
> 
> 
> I manage to get rid of that one by moving the import on top of my file.
> 
> Note: Python 2.4.1 under Windows
> 
> 
> Any clue ?

Do you have an encoding declaration in that file?  IIRC 2.4.1 gave
spurious syntax errors in some cases with files having coding
declarations.


John



More information about the Python-list mailing list