very strange syntax errors

Georg Brandl g.brandl at gmx.net
Wed Mar 28 19:52:46 CEST 2007


Peter Otten schrieb:
> hg wrote:
> 
>> 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 ?
> 
> A guess: you may have mixed Unix ("\n") and Windows ("\r\n") newlines. Try
> to ensure that every line ends with "\r\n".

That shouldn't be a problem since Python reads source files in universal
newline mode.

Georg




More information about the Python-list mailing list