473,811 Members | 2,566 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

always raise syntax error!

I'm not quite new to this language, but such error has never happened
so frequently before. I have no idea what to do about it, because
there's actually no syntax error at all !!

I'm using python 2.4.3 on windows, with gvim..
I realize this might because of the tab and space, so I use listchars
in vim to all my tabs and trailing spaces visible, make sure they are
used consistently, but python still raise syntax error, no further
description, and just make no sense to me.

anyone heard of such issue or the like before?
many thanks....

daniel

Oct 13 '06 #1
4 1967
On Thu, 12 Oct 2006 23:25:58 -0700, daniel wrote:
I'm not quite new to this language, but such error has never happened
so frequently before. I have no idea what to do about it, because
there's actually no syntax error at all !!
Looking into my crystal ball, I see that you are correct, there is no
syntax error -- because there is no code! There might not even be a
computer. It is all an illusion brought on by lack of fresh air.

Or maybe not -- my crystal ball is notoriously unreliable.

How about you post the FULL traceback of the error, so we can see for
ourselves if there is a syntax error or not?

e.g.
>>x{4} = 5
File "<stdin>", line 1
x{4} = 5
^
SyntaxError: invalid syntax

--
Steven

Oct 13 '06 #2
thank you so much for the reply.

I finally re-type all the codes where python would raise syntax error,
then fixed. I did not examine every single word of my old codes though,
there might be some parenthesis not matching somewhere, I guess.

well, I would say, the reason why I could not position the error code
may partly due to the ambiguous message that python provides. the lines
that python pointed to contains no error, I think the error codes must
be too far away from there. anyway, I hope python would make more
detailed error messages, like c++ compilers do. such as: "missing ;" or
"(" not matching...etc.

tks again..

daniel

Oct 13 '06 #3
daniel wrote:
thank you so much for the reply.

I finally re-type all the codes where python would raise syntax error,
then fixed. I did not examine every single word of my old codes though,
there might be some parenthesis not matching somewhere, I guess.

well, I would say, the reason why I could not position the error code
may partly due to the ambiguous message that python provides. the lines
that python pointed to contains no error, I think the error codes must
be too far away from there. anyway, I hope python would make more
detailed error messages, like c++ compilers do. such as: "missing ;" or
"(" not matching...etc.

tks again..

daniel
What Steve is trying to tell you is that you need to copy/paste your
code (with the full traceback) in future messages. We are not mind
readers out here.

Occassionally I will have phantom syntax errors that seem to be
attributable to non-printing characters in a line. Other times the
error is in fact far above the place pointed to by the syntax error.
Start by commenting out large chunks of code with triple quotes and
slowly work towards the lines with a problem.

-Larry Bates
Oct 13 '06 #4
In article <rO************ *************** ***@comcast.com >,
Larry Bates <la*********@we bsafe.comwrote:
>daniel wrote:
Oct 16 '06 #5

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

Similar topics

3
1835
by: James Stroud | last post by:
Hello All, Is this a bug? Why is this tuple getting unpacked by raise? Am I missing some subtle logic? Why does print not work the same way as raise? Both are statements. Why does raise need to be so special? py> sometup = 1,2 py> print sometup (1, 2) py> print 1,2,3, sometup
2
5451
by: Bogdan Zamfir | last post by:
Hi, I have a problem with err.raise I write a class module, and I want to use this mechanism to indicate errors when user set wrong values to properties But it seems the error is never raised (although, when I exit from the property let code, if I check err.number and message, I get the error message I set in err.raise statement But my calling code never throw me into error handler if I set wrong
7
1174
by: Steven W. Orr | last post by:
In my class I have class Error(Exception): """Base class for exceptions in this module.""" pass class TransitionError(Error): """Raised when an operation attempts a state transition that's not allowed.
4
1578
by: Alex G | last post by:
Does anyone know how I would go about conditionally raising an exception in a decorator (or any returned function for that matter)? For example: def decorator(arg): def raise_exception(fn): raise Exception return raise_exception class some_class(object):
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10651
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10136
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7671
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6893
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4341
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3020
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.