473,320 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

very strange syntax errors

hg
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 ?

Thanks,

hg
Mar 28 '07 #1
10 1421
hg
hg wrote:
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 ?

Thanks,

hg

PS:

and I also get some even weirder studd such as an error on line 374 when I
add a print on line 65

I'm using pydev + pydev ext

hg

Mar 28 '07 #2

"hg" <hg@nospam.orgwrote in message
news:l4********************@newsfe14.lga...
| 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 ?

Mixing tabs and spaces and not matching (s and 's are typical causes.

Mar 28 '07 #3
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".

Peter

Mar 28 '07 #4
This might be stating the obvious, but have you detabbed your text,
if you are using spaces?
On 28/03/2007, at 8:18 PM, hg wrote:
hg wrote:
>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 ?

Thanks,

hg


PS:

and I also get some even weirder studd such as an error on line 374
when I
add a print on line 65

I'm using pydev + pydev ext

hg

--
http://mail.python.org/mailman/listinfo/python-list


Mar 28 '07 #5
>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.
...
hgPS:

hgand I also get some even weirder studd such as an error on line 374
hgwhen I add a print on line 65

I think you're going to have to post a bit more of your code and some actual
tracebacks if people are to understand what the problem is. For example, we
can't tell what the relationship is in your code between lines 65 and 374
without actually seeing the code. I could look at those lines in an
arbitrary bit of my own code, but i doubt it would help. Maybe not all of
your code, but a few lines of code around the suspect points.

Skip

Mar 28 '07 #6
hg wrote:

I'v been facing some very strange errors lately:

one example:
You'll need to paste here the exact code and the traceback.

Regards,

--
.. Facundo
..
Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/
Mar 28 '07 #7
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

Mar 28 '07 #8
hg
Facundo Batista wrote:
hg wrote:

>I'v been facing some very strange errors lately:

one example:

You'll need to paste here the exact code and the traceback.

Regards,

--
. Facundo
.
Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/
Hi,

the code is _very_ long and has many dependencies (the longest file has a
few thousand lines (GUI callbacks) ... I know, need to refactor / but my
client is in a hurry right now so that'll wait )

So I'm not sure how I can provide any source that'll help .

I'll try the untab function of pydev on all files and see whether that fixes
the problems

hg

Mar 28 '07 #9
Georg Brandl wrote:
Peter Otten schrieb:
>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.
Oops, I should have guessed /that/.

Peter
Mar 28 '07 #10
hg <hg@nospam.orgwrites:
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
Mar 31 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Samuel Hon | last post by:
Hi I've done a search and found plenty on ORDER BY problems, but mines hopefully a syntax error. This is a test segment from my stored procedure. DECLARE @Name varchar(50), @SortType Int
9
by: Robert Misiorowski | last post by:
Hello, I have a very perplexing (at least to me) problem that hopefully someone can help me with. I'm making a site with a 3 column layout. In the middle column (my fluid column) I am trying to...
3
by: Gary Besta | last post by:
I am trying to add a simple case statement to a stored procedure or user defined function. However when I try and save the function/procedure I get 2 syntax errors. Running the query in query...
6
by: Chad | last post by:
I'm not too sure if the question would fall under comp.lang.c or some kind of compiler newsgroup. I'm going to ask anyhow. Given the following: #include <stdio.h> int main(void) { int a =...
1
by: Larax | last post by:
Alright, so here's the problem. I define a global variable in my script and then add methods/properties to it. Everything works great, no error in Javascript Console. But when I refresh site,...
12
by: cpptutor2000 | last post by:
I am new to PHP and I am having a very odd problem. Could some PHP guru please help. I am passing some variables from one page to the next, and in the starting page, I have: <div...
11
by: VijaKhara | last post by:
Hi all, I just write a very simple codes in C and vthere is a very strange bug which I cannot figure out why. The first loop is for v, and the second for k. There is no relationship between v...
1
by: Dariusz Tomon | last post by:
Hello, Till yesterday everything went well but I had to install service pack 2 to windows 2003 serv. After that every time I get strange JS errors (but could not debug it). Example:...
56
by: mdh | last post by:
As I begin to write more little programs without the help of the exercises, little things pop up that I need to understand more fully. Thus, below, and although this is not the exact code, the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.