Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Finding "hidden" syntax errors

Reply
Thread Tools

Finding "hidden" syntax errors

 
 
Larry Bates
Guest
Posts: n/a
 
      06-11-2004
It doesn't happen often, but once in a while I will
introduce a syntax error into a Python program I'm
working on (in IDLE) and doing File-Check responds
with the expected "Failed to check, syntax error -
invalid syntax". The problem is where the cursor
stops is perfectly legal syntax. I then begin
going through the laborious job of cutting out
pieces of the code until I find what is wrong. Is
there some easier way of doing this. I tried
pychecker but got nowhere because it said it
couldn't import (which I'm sure is because of the
syntax error). Does anyone out there have a "better"
way of tracking down these difficult to locate
errors?

Thanks in advance for any hints.

Regards,
Larry Bates
Syscon, Inc.



 
Reply With Quote
 
 
 
 
Miki Tebeka
Guest
Posts: n/a
 
      06-13-2004
Hello Larry,

> I tried pychecker but got nowhere because it said it couldn't import
> (which I'm sure is because of the syntax error). Does anyone out there
> have a "better" way of tracking down these difficult to locate errors?

I'm using pychecker. It says where the error is:
--- syn.py ---
def f(x):
if x = 2: # Syntax error
print "YO"
else:
print "Halt! Who goes there?"
--- syn.py ---

[10:45] $pychecker syn.py
Processing syn...
SyntaxError: invalid syntax (syn.py, line 2)
if x = 2: # Syntax error
^

Warnings...

syn:1: NOT PROCESSED UNABLE TO IMPORT
[10:45] $

pychecker found out that the problem is in line 2.

Maybe some concrete example?

Bye.
--
-------------------------------------------------------------------------
Miki Tebeka <(E-Mail Removed)>
The only difference between children and adults is the price of the toys.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why does catching errors that aren't thrown give syntax errors? yawnmoth Java 97 02-27-2009 12:07 AM
Help finding this syntax error Patrick Li Ruby 13 08-01-2008 09:58 PM
Finding Server... Finding Host.... enough already!!! Leesa_Tay@softhome.net Computer Support 2 01-20-2006 10:23 AM
Re: Finding "hidden" syntax errors eltronic@juno.com Python 1 06-14-2004 12:05 AM
Errors, errors, errors Mark Goldin ASP .Net 2 01-17-2004 08:05 PM



Advertisments