Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Aaaargh! "global name 'eggz' is not defined"

Thread Tools

Aaaargh! "global name 'eggz' is not defined"

Lie Ryan
Posts: n/a
Aahz wrote:
> In article <(E-Mail Removed)>,
> Robert Kern <(E-Mail Removed)> wrote:
>> I like using pyflakes. It catches most of these kinds of typo errors, but is
>> much faster than pylint or pychecker.

> Coincidentally, I tried PyFlakes yesterday and was unimpressed with the
> way it doesn't work with "import *".

If only IDLE's Intellisense worked without having to run the code first,
perhaps I wouldn't have abandoned using IDE altogether to write codes
and used vim/gedit/notepad/whateverpad instead. I've felt liberlized
since going plaintext.
Reply With Quote
Fabio Zadrozny
Posts: n/a
On Thu, Oct 29, 2009 at 6:48 PM, kj <(E-Mail Removed)> wrote:
> How can one check that a Python script is lexically correct?
> As my Python apps grow in complexity and execution, I'm finding it
> more often the situation in which a program dies after a lengthy
> (i.e. expensive) run because the execution reaches, say, a typo.
> Of course, this typo needs to be fixed, but I'd like to find out
> about it before I waste hours on a run that is bound to fail. *Is
> there any way to do this? *I imagine the answer is no, because
> given Python's scoping rules, the interpreter can't know about
> these things at compile time, but I thought I'd ask.

Pydev has a code-analysis feature which works analyzing the code while
you're typing. See:


Reply With Quote
Alan Franzoni
Posts: n/a
On 10/29/09 9:48 PM, kj wrote:
> How can one check that a Python script is lexically correct?

You can use a pseudo-static analyzer like pyflakes, pylint or pydoctor.

Or, better, you can avoid wild imports, excessive local or global
namespace manipulation, and break you program in smaller parts and write
unit tests for them.

Typos are very common but should very easy to catch. If you're not
catching them until a very long run of your program, then your code
coverage is probably too low.

Alan Franzoni
contact me at public@[mysurname].eu
Reply With Quote
Posts: n/a
On Oct 30, 8:53*am, Bruno Desthuilliers <bruno.
(E-Mail Removed)> wrote:
> Robert Kern a écrit :> On 2009-10-29 16:52 PM, Aahz wrote:
> (snip)
> >> Coincidentally, I tried PyFlakes yesterday and was unimpressed with the
> >> way it doesn't work with "import *".

> > I consider "import *" the first error to be fixed, so it doesn't bother
> > me much.

> +1 QOTW

Bruno, do you actually get to decide the QOTW? Because everytime you `
+1 QOTW` it gets to be the QOTW.


BTW I was the grateful recipient of your vote the other week.
Reply With Quote

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
adding a variable name to a hash to name is part of the variable name Bobby Chamness Perl 2 04-22-2007 09:54 PM
print("my name is {name}, and {age}-year old {gender}", name, age, gender); =?iso-8859-1?B?bW9vcJk=?= Java 7 01-02-2006 04:39 PM
IE name="name" & property bug Java script Dude Javascript 5 06-30-2004 03:07 AM
name = name.substring(0, name.lastIndexOf('.')); Help please Jack-2 Javascript 3 12-24-2003 04:39 PM
Re: Urgent! how to get object name, method name and attribute name based on the strings? ding feng C++ 2 06-25-2003 01:18 PM