NameError

2016-11-23 Thread Cai Gengyang
>>> pygame.draw.rect(screen, BROWN, [60, 400, 30, 45]) Traceback (most recent call last): File "", line 1, in pygame.draw.rect(screen, BROWN, [60, 400, 30, 45]) NameError: name 'pygame' is not defined How to solve this error ? -- https://mail.python.org/mailman/listinfo/python-list

Re: NameError

2016-11-23 Thread Joel Goldstick
On Wed, Nov 23, 2016 at 9:44 PM, Cai Gengyang wrote: >>>> pygame.draw.rect(screen, BROWN, [60, 400, 30, 45]) > Traceback (most recent call last): > File "", line 1, in > pygame.draw.rect(screen, BROWN, [60, 400, 30, 45]) > NameError: name 'pygame'

Re: NameError

2016-11-23 Thread Cai Gengyang
game.draw.rect(screen, BROWN, [60, 400, 30, 45]) > > NameError: name 'pygame' is not defined > > > > How to solve this error ? > > -- > > https://mail.python.org/mailman/listinfo/python-list > > have you imported pygame? > > -- > Jo

Re: NameError

2016-11-23 Thread Thomas Nyberg
On 11/23/2016 10:02 PM, Cai Gengyang wrote: I tried to import pygame by using these commands https://www.google.com.sg/#q=how+to+import+pygame but this is the error I got : CaiGengYangs-MacBook-Pro:~ CaiGengYang$ sudo apt-get install python-pygam

Re: NameError

2016-11-23 Thread Cai Gengyang
Yea, using Mac Following the instructions here for Mac ---https://bitbucket.org/pygame/pygame/issues/82/homebrew-on-leopard-fails-to-install#comment-627494 GengYang Cai CaiGengYangs-MacBook-Pro:~ CaiGengYang$ brew install python ==> Installing dependencies for python: xz, pkg-config, readline,

Re: NameError

2016-11-23 Thread Nathan Ernst
I don't see anything in that output resembling an error, just a few warnings that some features may no be available. Have you tried importing pygame after you did that? That's what'll prove one way or another that it worked. Regards, Nate On Wed, Nov 23, 2016 at 10:48 PM, Cai Gengyang wrote: >

Re: NameError

2016-11-24 Thread Cai Gengyang
CaiGengYangs-MacBook-Pro:~ CaiGengYang$ import pygame -bash: import: command not found On Thursday, November 24, 2016 at 1:22:56 PM UTC+8, Nathan Ernst wrote: > I don't see anything in that output resembling an error, just a few > warnings that some features may no be available. > > Have you tr

Re: NameError

2016-11-24 Thread Thomas Nyberg
On 11/24/2016 09:00 AM, Cai Gengyang wrote: CaiGengYangs-MacBook-Pro:~ CaiGengYang$ import pygame -bash: import: command not found That indicates you're running "import pygame" at the bash interpreter prompt. You should first start "python" (type the word python without quotes and press enter

Re: NameError

2016-11-24 Thread Cai Gengyang
CaiGengYangs-MacBook-Pro:~ CaiGengYang$ python Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import pygame Traceback (most recent call last): File "", li

Re: NameError

2016-11-24 Thread Cai Gengyang
Hmm, so whats the solution ? On Thursday, November 24, 2016 at 11:07:05 PM UTC+8, alister wrote: > On Thu, 24 Nov 2016 06:00:20 -0800, Cai Gengyang wrote: > > > CaiGengYangs-MacBook-Pro:~ CaiGengYang$ import pygame -bash: import: > > command not found > > > > > > > please do not top post as

Re: NameError

2016-11-24 Thread alister
On Thu, 24 Nov 2016 06:00:20 -0800, Cai Gengyang wrote: > CaiGengYangs-MacBook-Pro:~ CaiGengYang$ import pygame -bash: import: > command not found > > > please do not top post as it makes the threads difficult to follow the preferred style is interleave posing (posting a reply after the text yo

Re: NameError

2016-11-24 Thread alister
On Thu, 24 Nov 2016 07:09:22 -0800, Cai Gengyang wrote: > Hmm, so whats the solution ? > > The solution is to bottom post or interleave post as previously stated > > On Thursday, November 24, 2016 at 11:07:05 PM UTC+8, alister wrote: >> On Thu, 24 Nov 2016 06:00:20 -0800, Cai Gengyang wrote: >

Re: NameError

2016-11-24 Thread Cai Gengyang
I mean whats the solution to import pygame ? How to import pygame ? On Thursday, November 24, 2016 at 11:22:07 PM UTC+8, alister wrote: > On Thu, 24 Nov 2016 07:09:22 -0800, Cai Gengyang wrote: > > > Hmm, so whats the solution ? > > > > > The solution is to bottom post or interleave post as pre

Re: NameError

2016-11-24 Thread Cai Gengyang
CaiGengYangs-MacBook-Pro:~ CaiGengYang$ pip install pygame Collecting pygame Could not find a version that satisfies the requirement pygame (from versions: ) No matching distribution found for pygame You are using pip version 7.1.2, however version 9.0.1 is available. You should consider upgradi

Re: NameError

2016-11-24 Thread alister
On Thu, 24 Nov 2016 07:25:37 -0800, Cai Gengyang wrote: > I mean whats the solution to import pygame ? How to import pygame ? > > > On Thursday, November 24, 2016 at 11:22:07 PM UTC+8, alister wrote: >> On Thu, 24 Nov 2016 07:09:22 -0800, Cai Gengyang wrote: >> >> > Hmm, so whats the solution ?

Re: NameError

2016-11-24 Thread Michael Torrie
As alister said, please do not just hit reply and type your message at the top. Instead, place your reply below the quoted text you are replying too. This is not hard. I realize there's a language barrier, but please patiently read what alister said and understand what he's saying. I know you're

Re: NameError

2016-11-24 Thread Cai Gengyang
This is what I got : CaiGengYangs-MacBook-Pro:~ CaiGengYang$ /usr/local/bin/python3 Python 3.5.1 (v3.5.1:37a07cee5969, Dec 5 2015, 21:12:44) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import pygame Traceback (

Re: NameError

2016-11-25 Thread Cai Gengyang
I can't import it --- keep getting an importerror message. Can you try, let me know if it works and show me the code ? Thanks alot , appreciate it ... On Thu, Nov 24, 2016 at 1:22 PM, Nathan Ernst wrote: > I don't see anything in that output resembling an error, just a few > warnings that some f

Newbie NameError problem

2007-12-12 Thread MartinRinehart
I don't understand what I don't understand in the following: -- # reader.py - testing char-by-char marching methods f = open('sample_decaf.d', 'r') text = f.readlines() f.close() # this is C-style, 15 lines, in Python: end_line = len(text) line_ptr = 0 whi

NameError vs AttributeError

2012-07-31 Thread Ulrich Eckhardt
Hi! Using Python 2.7, I stumbled across the fact that 'self.xy' raises an AttributeError if self doesn't have an 'xy' as attribute, but 'xy' will instead raise a NameError. To some extent, these two are very similar, namely that the name 'xy' c

Newbie -> NameError: getopt

2011-04-04 Thread Mustafa Cayci
ot;/home/oracle/wlsuserconfigfiles/./Health_Check_Servers.py", line 22, in main NameError: getopt I thought I was importing the "getopt" as shown below. Thanks for you help in advance, Mustafa #Conditionally import wlstModule only when script is executed with jython if __name__ == &#

Global NameError Fix?

2013-03-21 Thread maiden129
Hello, I'm using the version 3.2.3 of Python and I am having an issue in my program and I don't know how to fix it: counterLabel["text"] = str(counter) NameError: global name 'counterLabel' is not defined Here is my program: from tkinter import * class C

NameError function not found

2009-05-29 Thread Cameron Pulsford
rs()): newmatrix.append(_determinant(minor.matrix) * ((i%2) * -1)) return newmatrix And I get the following error when I try to run a.cofactor()... "NameError: global name '_determinant' is not defined" When I put the _determinant function nested within the cofactor function

Exception handling with NameError

2010-11-05 Thread Zeynel
Hello, I want to append new input to list SESSION_U without erasing its content. I try this: ... try: SESSION_U.append(UNIQUES) except NameError: SESSION_U = [] SESSION_U.append(UNIQUES) ... I would think that at first try I would get the

nameerror upon calling function

2007-09-01 Thread seancron
Hi, I have a program that makes a call to a function in a different python script that I wrote. But, when I call the function I get the following error: NameError: global name 'WSDL' is not defined I can't figure out why I'm getting this error since WSDL should be defin

Re: Newbie NameError problem

2007-12-12 Thread Calvin Spealman
gy-code.blogspot.com/2007/02/minimal-working-examples-how-to- why-and.html) where working means it works to demonstrate the problem you are having. You need to actually show us what is breaking, which means the traceback that gives you the NameError. As for the problem itself, I am not go

Re: Newbie NameError problem

2007-12-12 Thread cokofreedom
On Dec 12, 5:51 pm, Paul Rudin <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] writes: > > I don't understand what I don't understand in the following: > > I haven't tried to understand what your code is doing - but the > NameError arises because you try to u

Re: Newbie NameError problem

2007-12-12 Thread Paul Rudin
[EMAIL PROTECTED] writes: > I don't understand what I don't understand in the following: I haven't tried to understand what your code is doing - but the NameError arises because you try to use Loc before its definition. Put the definition first and the error should g

Re: Newbie NameError problem

2007-12-12 Thread Sion Arrowsmith
<[EMAIL PROTECTED]> wrote: >I don't understand what I don't understand in the following: > [ ... ] You've already got an answer as to what's causing your name error. But that's not your only problem. It looks like you need an introduction to enumerate(): for line_ptr, text in enumerate(file('sam

Re: Newbie NameError problem

2007-12-12 Thread Bruno Desthuilliers
27;s a reference to the current instance. If you want to define instance attributes, you have to set these attributes on the current instance. def __init__(self, line, char): self.line = line self.char = char > def nextChar(self): > char += 1 NameError here. You want self.char

Re: Newbie NameError problem

2007-12-12 Thread Paul Rudin
[EMAIL PROTECTED] writes: > On Dec 12, 5:51 pm, Paul Rudin <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] writes: >> > I don't understand what I don't understand in the following: >> >> I haven't tried to understand what your code is doing - but

Re: Newbie NameError problem

2007-12-12 Thread Carsten Haese
On Wed, 2007-12-12 at 12:48 -0800, [EMAIL PROTECTED] wrote: > Thanks to all! > > I will put my class defs first (tho not without expressing my > disappointment that this is required in a late 20th century language); You don't have to physically *put* class definitions first in your code. What mat

Re: Newbie NameError problem

2007-12-12 Thread MartinRinehart
Thanks to all! I will put my class defs first (tho not without expressing my disappointment that this is required in a late 20th century language); learn about enumerate as it looks like exactly what I need and discard my C++/Java based object model because this is a totally other thing. If someo

Re: Newbie NameError problem

2007-12-12 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Thanks to all! > > I will put my class defs first (tho not without expressing my > disappointment that this is required in a late 20th century language); That's because you dont get the "execution model" of Python. First point, remember that Python in Python everyth

Re: Newbie NameError problem

2007-12-13 Thread cokofreedom
> > >> I haven't tried to understand what your code is doing - but the > >> NameError arises because you try to use Loc before its definition. Put > >> the definition first and the error should go away. > > > Class Loc must be placed ABOVE the code tha

dynamic type returning NameError:

2013-07-28 Thread Tim O'Callaghan
success. So, attempting this at runtime I get a plethora of wonderful errors that I suspect has broken my brain. Here is what i've tried: # trying with just an empty object of type BaseClass obj = type("Object", (BaseClass,), {}) whatever = type("WhatEver", (obj,), {

Re: NameError vs AttributeError

2012-07-31 Thread Terry Reedy
On 7/31/2012 6:36 AM, Ulrich Eckhardt wrote: Hi! Using Python 2.7, I stumbled across the fact that 'self.xy' raises an AttributeError if self doesn't have an 'xy' as attribute, but 'xy' will instead raise a NameError. To some extent, these two are ver

Re: NameError vs AttributeError

2012-07-31 Thread Chris Kaynor
On Tue, Jul 31, 2012 at 1:21 PM, Terry Reedy wrote: > Another example: KeyError and IndexError are both subscript errors, but > there is no SubscriptError superclass, even though both work thru the same > mechanism -- __getitem__. The reason is that there is no need for one. In > 'x[y]', x is us

Re: NameError vs AttributeError

2012-07-31 Thread Terry Reedy
On 7/31/2012 4:49 PM, Chris Kaynor wrote: On Tue, Jul 31, 2012 at 1:21 PM, Terry Reedy mailto:tjre...@udel.edu>> wrote: Another example: KeyError and IndexError are both subscript errors, but there is no SubscriptError superclass, even though both work thru the same mechanism -- __ge

Re: NameError vs AttributeError

2012-08-01 Thread Ethan Furman
, so there is. Added in 1.5 strictly as a never-directly-raised base class for the above pair, now also directly raised in codecs.lookup. I have not decided if I want to replace the tuple in the code in my book. I think I'd stick with the tuple -- LookupError could just as easily encompas

Re: NameError vs AttributeError

2012-08-01 Thread Terry Reedy
mpass NameError and AttributeError. Thank you. Having to remember exactly which lookup error is encompassed by LookupError illustrates my point about the cost of adding entities without necessity. It also illustrates the importance of carefull naming. SubscriptError might have been better. -- Terr

Re: Newbie -> NameError: getopt

2011-04-04 Thread R. Tyler Croy
gt; File "/home/oracle/wlsuserconfigfiles/./Health_Check_Servers.py", line > 80, in > ? > File "/home/oracle/wlsuserconfigfiles/./Health_Check_Servers.py", line > 22, in > main > NameError: getopt > > I thought I was importing the "getopt" as shown belo

Re: Global NameError Fix?

2013-03-21 Thread Dave Angel
On 03/21/2013 07:43 PM, maiden129 wrote: Hello, I'm using the version 3.2.3 of Python and I am having an issue in my program and I don't know how to fix it: counterLabel["text"] = str(counter) NameError: global name 'counterLabel' is not defined Please inc

Re: Global NameError Fix?

2013-03-21 Thread David Robinow
On Thu, Mar 21, 2013 at 7:43 PM, maiden129 wrote: > Hello, > > I'm using the version 3.2.3 of Python and I am having an issue in my program > and I don't know how to fix it: > > counterLabel["text"] = str(counter) > NameError: global name 'count

Re: Global NameError Fix?

2013-03-22 Thread Rick Johnson
On Thursday, March 21, 2013 7:24:17 PM UTC-5, Dave Angel wrote: > On 03/21/2013 07:43 PM, maiden129 wrote: > > Hello, > > > I'm using the version 3.2.3 of Python and I am having an > > issue in my program and I don't know how to fix it: > > > counte

Re: NameError function not found

2009-05-29 Thread Jason Tackaberry
On Fri, 2009-05-29 at 15:13 -0400, Cameron Pulsford wrote: > def _determinant(m): >return m[0][0] * m[1][1] - m[1][0] * m[0][1] Given that this has no self argument, I'm assuming this is not a class method. > def cofactor(self): >"""Returns the cofactor of a matrix.""" Given that this d

Re: NameError function not found

2009-06-01 Thread Jean-Michel Pichavant
minor in enumerate(self.minors()): newmatrix.append(_determinant(minor.matrix) * ((i%2) * -1)) return newmatrix And I get the following error when I try to run a.cofactor()... "NameError: global name '_determinant' is not defined" When I put the _determinant function nested withi

Re: Exception handling with NameError

2010-11-05 Thread Peter Otten
Zeynel wrote: > I want to append new input to list SESSION_U without erasing its > content. I try this: > > ... > try: > SESSION_U.append(UNIQUES) > except NameError: > SESSION_U = [] > SESSION_U.append(UNIQUES) &g

Re: Exception handling with NameError

2010-11-05 Thread Zeynel
RCHIVE is erased: If I do this: K = [] ARCHIVE.append(K) I get NameError: "Name ARCHIVE not defined" What is the solution? -- http://mail.python.org/mailman/listinfo/python-list

Re: Exception handling with NameError

2010-11-06 Thread Peter Otten
Dennis Lee Bieber wrote: >> The problem I am having is this: If I do: >> >> K = [] >> ARCHIVE = [] >> ARCHIVE.append(K) >> >> any time K is updated (user submits new input) the content of ARCHIVE >> is erased: >> > No, it is NOT erased... It is MUTATED... But he rebinds the ARCHIVE name. -- ht

Re: Exception handling with NameError

2010-11-06 Thread Peter Otten
blem I am having is this: If I do: > > K = [] > ARCHIVE = [] > ARCHIVE.append(K) > > any time K is updated (user submits new input) the content of ARCHIVE > is erased: > > If I do this: > > K = [] > ARCHIVE.append(K) > > I get NameError: "Name ARCHIVE

Re: nameerror upon calling function

2007-09-01 Thread Arnaud Delobelle
On Sep 1, 5:05 pm, seancron <[EMAIL PROTECTED]> wrote: > Hi, > > I have a program that makes a call to a function in a different python > script that I wrote. But, when I call the function I get the > following error: > > NameError: global name 'WSDL' is not d

Re: dynamic type returning NameError:

2013-07-28 Thread Terry Reedy
whatever = type("WhatEver", (obj,), {"method1": super(WhatEver, self).request("method1")}) 'method1' has to be mapped to a function object. but when i try this I get 'NameError: name 'self' is not defined' defining these c

Re: dynamic type returning NameError:

2013-07-28 Thread Tim O'Callaghan
> > > So, attempting this at runtime I get a plethora of wonderful errors that I > > suspect has broken my brain. > > > > > > Here is what i've tried: > > > > > > # trying with just an empty object of type BaseClass > > >

Re: dynamic type returning NameError:

2013-07-28 Thread Steven D'Aprano
x27;ve been trying to do this using the python cli, with out success. > > So, attempting this at runtime I get a plethora of wonderful errors that > I suspect has broken my brain. > > Here is what i've tried: > > # trying with just an empty object of type BaseClass > obj

Re: dynamic type returning NameError:

2013-07-29 Thread Tim O'Callaghan
id_data > > > > > > def method2(self): > > > stupid_data = super(Whatever, self).request("method1") > > > return stupid_data > > > > > > Since request is not the method you are currently in, the above i

PyWart: NameError trackbacks are superfluous

2013-03-16 Thread Rick Johnson
uot;C:/a/b/c/mod3.py", line 2, in import mod2 File "C:/a/b/c/mod2.py", line 1, in import mod1 File "C:/a/b/c/mod1.py", line 2, in print symbolNonExistant NameError: name 'symbolNonExistant' is not defined Why did i need to see all that junk w

NameError: name '__version__' is not defined

2023-10-27 Thread Loris Bennett via Python-list
: NameError: name '__version__' is not defined For the 3.6 application I have PYTHONPATH=/nfs/local/lib/python3.6/site-packages PYTHONUSERBASE=/nfs/local PYTHON_VERSION=3.6 PYTHON_VIRTUALENV= and for the 3.10 application I have PYTHONPATH=/nfs/easybuild/software/Python/3.10

NameError: name '__main__' is not defined

2009-09-13 Thread Peng Yu
recent call last): File "./test.py", line 3, in if __main__ == '__main__' : NameError: name '__main__' is not defined -- http://mail.python.org/mailman/listinfo/python-list

NameError: name 'execfile' is not defined

2009-03-11 Thread Henrik Bechmann
Newbie issue: I downloaded http://www.python.org/download/releases/3.0.1/ (windows insaller), opened the interpreter, wrote a print "Hello World" program in helloworld.py, and in the interpreter typed execfile("helloworld.py") Got back NameError: name 'execfile&#x

Profiler throws NameError on any function

2009-03-26 Thread Philipp Lies
elf.runctx(cmd, dict, dict) File "/usr/lib/python2.5/profile.py", line 462, in runctx exec cmd in globals, locals File "", line 1, in NameError: name 'foo' is not defined The very same error I get using cProfile. It works when I call profile.runctx('foo()&#x

Handling NameError in a list gracefully

2009-04-20 Thread Jesse Aldridge
cause get_selected_paths to throw a NameError. For example, say I delete the "project1" variable from my_paths; now I'll get a NameError when I call get_selected_paths. So everything that depends on the get_selected_paths function is crashing. I am wondering if there is an easy way to just

getopt code NameError exception on logTail.py

2009-07-17 Thread LoD MoD
py /var/log/system.log Traceback (most recent call last): File "logTail.py", line 52, in main() File "logTail.py", line 49, in main process(arg) # process() is defined elsewhere NameError: global name 'process' is not defined -- http://mail.python.org/mailman/listinfo/python-list

NameError: how to get the name?

2010-04-24 Thread Yingjie Lan
I wanted to do something like this: while True: try: def fun(a, b=b, c=c): pass except NameError as ne: name = get_the_var_name(ne) locals()[name] = '' else: break What's be best way to implement the function get_the_var_name(ne) that returns the name of th

Help needed to solve this "NameError"

2007-06-24 Thread senthil arasu
() once compiling iam getting the error Traceback (most recent call last): File "C:\chk.py", line 20, in **frame.pack() *NameError: name 'frame' is not defined * thanks -- http://mail.python.org/mailman/listinfo/python-list

NameError: name 'main' is not defined

2007-12-18 Thread jolly
hey guys, When i try to run my code I get an error. NameError name 'main is not defined' [code] if __name__ == "__main__": main() filename = "addbook.dat" def main(): theMenu = ''' 1) Add Entry 2) Remove Entry 3) Find E

NameError: name 'guess' is not defined

2008-03-22 Thread willkab6
do here print 'Done' After typing the above as the book says, I get the error NameError: name 'guess' is not defined What Am I doing wrong? -- http://mail.python.org/mailman/listinfo/python-list

NameError: name 'pyver' is not defined

2014-03-05 Thread שולמית מירל
Hello, We have python 2.6 & 3.2 installed on Sun solaris. When running py utility, we get the below error: "NameError: global name 'execfile' is not defined" > p4convert-cvs.py EXCEPTION: [Errno 17] File exists: './LOGS' Traceback (most recent call last)

NameError: name 'requests' is not defined ?

2014-07-27 Thread 水静流深
_package__', '__spec__', 'requests'] >>> url='http://quote.eastmoney.com/hk/0.html?StockCode=0' >>> requests.get(url) Traceback (most recent call last): File "", line 1, in NameError: name 'requests' is not defined why it run into "NameError: name 'requests' is not defined"?‍-- https://mail.python.org/mailman/listinfo/python-list

Re: PyWart: NameError trackbacks are superfluous

2013-03-16 Thread Oscar Benjamin
> offensive lookup of a name that does not exist. [SNIP] NameErrors can occur conditionally depending on e.g. the arguments to a function. Consider the following script: # tmp.py def broken(x): if x > 2: print(x) else: print(undefined_name) broken(1)

Re: PyWart: NameError trackbacks are superfluous

2013-03-16 Thread Rick Johnson
tph = ToiletPaperHolder() if not tph.has_roll(): tph.load_roll() roll = tph.get_active_roll() roll.bind("", maybeGoBoom) > The traceback shows the arguments passed to the broken > function that caused the NameError to be generated. > Different arguments would not have generat

Re: PyWart: NameError trackbacks are superfluous

2013-03-16 Thread Oscar Benjamin
On 16 March 2013 22:39, Rick Johnson wrote: > On Saturday, March 16, 2013 4:19:34 PM UTC-5, Oscar Benjamin wrote: > >> The traceback shows the arguments passed to the broken >> function that caused the NameError to be generated. >> Different arguments would not have ge

Re: PyWart: NameError trackbacks are superfluous

2013-03-16 Thread Tim Chase
On 2013-03-16 15:39, Rick Johnson wrote: > On Saturday, March 16, 2013 4:19:34 PM UTC-5, Oscar Benjamin wrote: > > # tmp.py > > def broken(x): > > if x > 2: > > print(x) > > else: > > print(undefined_name) > > > > broken(1) > > Why would anyone write code lik

Re: PyWart: NameError trackbacks are superfluous

2013-03-16 Thread Chris Angelico
arder(intelligence_level) > broken(op.iq) > > Pylint, pyflakes or some other such linter should catch it, but this > happens ALL THE TIME in actual development, occasionally leaking into > production. That's actually an argument in favour of declared variables. NameError beco

Re: PyWart: NameError trackbacks are superfluous

2013-03-16 Thread Steven D'Aprano
g. the arguments to a > function. Consider the following script: [...] Correct, although in your example, simply pointing at the relevant line of code is enough to establish the error. But that's an easy case. Tracebacks aren't printed because you need them to fix the easy bugs. Traceb

Re: PyWart: NameError trackbacks are superfluous

2013-03-16 Thread Rick Johnson
On Saturday, March 16, 2013 6:29:52 PM UTC-5, Oscar Benjamin wrote: > I wasn't looking to convince *you*, just to set the record > straight that this behaviour is sometimes useful. And you claim to "set the record strait" by posting code that *purposely* raises a NameErr

Re: PyWart: NameError trackbacks are superfluous

2013-03-16 Thread Chris Angelico
merely the side-effect. The actual problem occurs in the caller, > fail(). If NameError suppressed the traceback, that would be more > difficult to solve. A good example. It would be logically equivalent to set spam=None in stop(), and nobody would expect the TypeError to omit the traceba

Re: PyWart: NameError trackbacks are superfluous

2013-03-16 Thread Chris Angelico
On Sun, Mar 17, 2013 at 10:50 AM, Rick Johnson wrote: > * Superfluous trackbacks are not only ugly, they damage >productivity. Extraordinary claims require extraordinary evidence. Start evidencing. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: PyWart: NameError trackbacks are superfluous

2013-03-16 Thread Rick Johnson
On Saturday, March 16, 2013 6:48:01 PM UTC-5, Steven D'Aprano wrote: > On Sat, 16 Mar 2013 21:19:34 +, Oscar Benjamin wrote: > > [...] > > NameErrors can occur conditionally depending on e.g. the > > arguments to a function. Consider the following script: > [...] > > Correct, although in your e

Re: PyWart: NameError trackbacks are superfluous

2013-03-16 Thread Michael Torrie
On 03/16/2013 06:11 PM, Rick Johnson wrote: > No, the "ACTUAL PROBLEM" is in the author. Surely any NameException can also be blamed on the author then, by your logic? -- http://mail.python.org/mailman/listinfo/python-list

Re: PyWart: NameError trackbacks are superfluous

2013-03-16 Thread Steven D'Aprano
On Sat, 16 Mar 2013 19:58:41 -0600, Michael Torrie wrote: > On 03/16/2013 06:11 PM, Rick Johnson wrote: >> No, the "ACTUAL PROBLEM" is in the author. > > Surely any NameException can also be blamed on the author then, by your > logic? Any exception at all is obviously the author's fault. I propo

Re: PyWart: NameError trackbacks are superfluous

2013-03-16 Thread Chris Angelico
On Sun, Mar 17, 2013 at 2:14 PM, Steven D'Aprano wrote: > On Sat, 16 Mar 2013 19:58:41 -0600, Michael Torrie wrote: > >> On 03/16/2013 06:11 PM, Rick Johnson wrote: >>> No, the "ACTUAL PROBLEM" is in the author. >> >> Surely any NameException can also be blamed on the author then, by your >> logic

Re: PyWart: NameError trackbacks are superfluous

2013-03-16 Thread Benjamin Kaplan
On Sat, Mar 16, 2013 at 8:14 PM, Steven D'Aprano wrote: > On Sat, 16 Mar 2013 19:58:41 -0600, Michael Torrie wrote: > >> On 03/16/2013 06:11 PM, Rick Johnson wrote: >>> No, the "ACTUAL PROBLEM" is in the author. >> >> Surely any NameException can also be blamed on the author then, by your >> logic

Re: PyWart: NameError trackbacks are superfluous

2013-03-17 Thread Jason Swails
line of that module > contains the offensive lookup of a name that does not exist. > [snip more junk] 2 comments here. 1) Where's the consistency?? NameError is an exception. All other exceptions get full tracebacks. A NameError is not special enough to deserve special treatment (zen of P

NameError: name 'msvcrt' is not defined

2019-09-26 Thread Hongyi Zhao
Hi, I use python on Debian, when running some python codes, I meet the following error: --- input_username.py", line 18, in read_input if msvcrt.kbhit(): NameError: name 'msvcrt' is not defined How to solve this issue? -- https://mail.python.org/m

Re: NameError: name '__version__' is not defined

2023-10-27 Thread Loris Bennett via Python-list
For the application with the system Python this mechanism works, but for > the non-system Python I get the error: > > NameError: name '__version__' is not defined > > For the 3.6 application I have > > PYTHONPATH=/nfs/local/lib/python3.6/site-packages >

Re: NameError: name '__version__' is not defined

2023-10-27 Thread Loris Bennett via Python-list
port importlib_metadata >> >> __version__ = importlib_metadata.version(__name__) >> >> For the application with the system Python this mechanism works, but for >> the non-system Python I get the error: >> >> NameError: name '__versio

Re: NameError: name '__version__' is not defined

2023-10-27 Thread Dieter Maurer via Python-list
Loris Bennett wrote at 2023-10-27 09:29 +0200: > ... >For the application with the system Python this mechanism works, but for >the non-system Python I get the error: > > NameError: name '__version__' is not defined If you get exceptions (they usually end in `Error` (su

Re: NameError: name '__main__' is not defined

2009-09-13 Thread Xavier Ho
g > > $ cat test.py > #!/usr/bin/env python > > if __main__ == '__main__' : > print "Hello World!\n" > $ ./test.py > Traceback (most recent call last): > File "./test.py", line 3, in >if __main__ == '__main__' : > Na

Re: NameError: name '__main__' is not defined

2009-09-13 Thread André
__ == '__main__' : >   print "Hello World!\n" > $ ./test.py > Traceback (most recent call last): >   File "./test.py", line 3, in >     if __main__ == '__main__' : > NameError: name '__main__' is not defined You wrote __main__

Re: NameError: name '__main__' is not defined

2009-09-13 Thread Sean DiZazzo
__ == '__main__' : >   print "Hello World!\n" > $ ./test.py > Traceback (most recent call last): >   File "./test.py", line 3, in >     if __main__ == '__main__' : > NameError: name '__main__' is not defined Is this a produc

Re: NameError: name '__main__' is not defined

2009-09-13 Thread Sean DiZazzo
__ == '__main__' : >   print "Hello World!\n" > $ ./test.py > Traceback (most recent call last): >   File "./test.py", line 3, in >     if __main__ == '__main__' : > NameError: name '__main__' is not defined erI was jus

Re: NameError: name '__main__' is not defined

2009-09-14 Thread Hendrik van Rooyen
python > > if __main__ == '__main__' : > print "Hello World!\n" > $ ./test.py > Traceback (most recent call last): > File "./test.py", line 3, in > if __main__ == '__main__' : > NameError: name '__main__' is not defined You ar

Re: NameError: name '__main__' is not defined

2009-09-14 Thread Andre Engels
On Mon, Sep 14, 2009 at 4:29 AM, Sean DiZazzo wrote: > Is this a production program that you are using?? > > Please show us the point you are trying to make in something more > valuable. I find this a very bad comment. Not only is it rude, it is condemning a behaviour I would see as beneficial.

Re: NameError: name 'execfile' is not defined

2009-03-12 Thread Gary Herron
Henrik Bechmann wrote: Newbie issue: I downloaded http://www.python.org/download/releases/3.0.1/ (windows insaller), opened the interpreter, wrote a print "Hello World" program in helloworld.py, and in the interpreter typed execfile("helloworld.py") Got back NameError: na

Re: NameError: name 'execfile' is not defined

2009-03-12 Thread Henrik Bechmann
in the interpreter typed > > > execfile("helloworld.py") > > > Got back > > > NameError: name 'execfile' is not defined > > > (following tutorial in David Beazley's Python Essential Reference). > > > Is execfile not support

Re: Profiler throws NameError on any function

2009-03-28 Thread Gabriel Genellina
thon2.5/profile.py", line 456, in run return self.runctx(cmd, dict, dict) File "/usr/lib/python2.5/profile.py", line 462, in runctx exec cmd in globals, locals File "", line 1, in NameError: name 'foo' is not defined The very same error I get using c

Re: Handling NameError in a list gracefully

2009-04-20 Thread Chris Rebert
list has around 50 entries.  Occasionally I'll > remove a variable from my_paths and cause get_selected_paths to throw > a NameError.  For example, say I delete the "project1" variable from > my_paths; now I'll get a NameError when I call get_selected_paths. > So ev

Re: Handling NameError in a list gracefully

2009-04-20 Thread Jesse Aldridge
Nevermind, I figured it out right after I clicked the send button :\ from my_paths import * def get_selected_paths(): return [globals()[s] for s in ["home", "desktop", "project1", "project2"] if s in globals()] -- http://mail.python.org/mailman/listinfo/python-list

Re: Handling NameError in a list gracefully

2009-04-20 Thread Jesse Aldridge
n like this which returns a list containing a bunch > > of variables.  The real list has around 50 entries.  Occasionally I'll > > remove a variable from my_paths and cause get_selected_paths to throw > > a NameError.  For example, say I delete the "project1" varia

  1   2   3   >