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 '__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 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 >

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

Re: return type same as class gives NameError.

2023-10-22 Thread Cameron Simpson via Python-list
n this function is defined, the class "Pnt" has not yet been defined. That happens afterwards. You want a forward reference, eg: def __add__(self, other: PNT) -> "Pnt": A type checker will resolve this after the fact, when it encounters the string in the type annotation.

Re: return type same as class gives NameError.

2023-10-22 Thread dn via Python-list
quot;", line 1, in   File "/home/sisc/projecten/iudex/problem.py", line 10, in     class Pnt (NamedTuple):   File "/home/sisc/projecten/iudex/problem.py", line 14, in Pnt     def __add__(self, other: PNT) -> Pnt: ^^^ NameError: nam

return type same as class gives NameError.

2023-10-22 Thread Antoon Pardon via Python-list
problem.py", line 10, in class Pnt (NamedTuple): File "/home/sisc/projecten/iudex/problem.py", line 14, in Pnt def __add__(self, other: PNT) -> Pnt: ^^^ NameError: name 'Pnt' is not defined. Did you mean: 'PN

Re: NameError: name 'msvcrt' is not defined

2019-09-26 Thread MRAB
On 2019-09-27 03:14, Hongyi Zhao wrote: 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 th

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: python3.7 error PYQT5 - NameError: name 'self' is not defined

2018-09-21 Thread Christopher Mullins
> > Hi when I disconnect the internet I get an error NameError: name 'self' is > not defined. I really dont get it.. thanks all. Is that a bug? or my fault? Exception in thread Thread-1: > Traceback (most recent call last): > File "C:\programming Alon\stock market

python3.7 error PYQT5 - NameError: name 'self' is not defined

2018-09-21 Thread alon . najman
Hi when I disconnect the internet I get an error NameError: name 'self' is not defined. I really dont get it.. thanks all. Is that a bug? or my fault? Exception in thread Thread-1: Traceback (most recent call last): File "C:\programming Alon\stock market app\PROJECT\AlonStockM

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

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-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 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 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 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 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 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 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 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$ 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-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-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 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
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 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'

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: h(re) for help, import re - on NameError

2016-09-23 Thread Chris Angelico
On Fri, Sep 23, 2016 at 4:40 PM, Peter Otten <__pete...@web.de> wrote: > By the way, the current help() already loads a module if you pass its name > as a string: > Yes, which is the basis of my alternate exec trick: exec(tb.tb_frame.f_code, tb.tb_frame.f_globals, {n: n}) Basically it creates a

Re: h(re) for help, import re - on NameError

2016-09-22 Thread Peter Otten
Veek M wrote: > Is there a way to use .pythonrc.py to provide a help function that > autoloads whatever module name is passed like so: By the way, the current help() already loads a module if you pass its name as a string: $ echo 'print("importing foo")' > foo.py $ python3 Python 3.4.3 (defaul

Re: h(re) for help, import re - on NameError

2016-09-22 Thread Veek M
erriding __init__ and __call__ >> but that didn't work, also I don't know how to deal/trap/catch the >> NameError (no quotes on h(re)) - is there a way to insert a >> try/except block around the >>> prompt? >> >> I hate having to: import whatever ev

Re: h(re) for help, import re - on NameError

2016-09-22 Thread Chris Angelico
n't work, also I don't know how to deal/trap/catch the NameError > (no quotes on h(re)) - is there a way to insert a try/except block > around the >>> prompt? > > I hate having to: import whatever every-time i forget. Actually could I > ditch the () in h(re) and jus

h(re) for help, import re - on NameError

2016-09-22 Thread Veek M
Is there a way to use .pythonrc.py to provide a help function that autoloads whatever module name is passed like so: \>>> h(re) I tried inheriting site._Helper and overriding __init__ and __call__ but that didn't work, also I don't know how to deal/trap/catch the NameError

Re: __del__: when to use it? What happens when you SystemExit/NameError wrt del? Method vs function calls.

2016-03-07 Thread Veek. M
Steven D'Aprano wrote: > On Monday 07 March 2016 17:13, Veek. M wrote: > >> import foo >> class Bar(object): >> def __del__(self, foo=foo): >> foo.bar()# Use something in module foo >> >> ### Why the foo=foo? import foo, would increment the ref-count for >> object 'foo' > > Yes. And

Re: __del__: when to use it? What happens when you SystemExit/NameError wrt del? Method vs function calls.

2016-03-07 Thread Steven D'Aprano
On Monday 07 March 2016 17:13, Veek. M wrote: > import foo > class Bar(object): > def __del__(self, foo=foo): > foo.bar()# Use something in module foo > > ### Why the foo=foo? import foo, would increment the ref-count for > object 'foo' Yes. And then at shutdown, the module globals

Re: __del__: when to use it? What happens when you SystemExit/NameError wrt del? Method vs function calls.

2016-03-06 Thread Veek. M
ys so why be finicky about circular > references - why can't we go ahead and call __dell_ and run gc? > > 3. > import foo > def __del__(self, foo=foo): > foo.bar() > > What happens here to prevent a NameError? Apparently without the > foo=foo a NameError can occ

Re: __del__: when to use it? What happens when you SystemExit/NameError wrt del? Method vs function calls.

2016-03-06 Thread Steven D'Aprano
stand the GC well enough to answer that question. > 3. > import foo > def __del__(self, foo=foo): > foo.bar() > > What happens here to prevent a NameError? Apparently without the foo=foo > a NameError can occur? But why? import foo creates a reference to the > object anyways so

Re: __del__: when to use it? What happens when you SystemExit/NameError wrt del? Method vs function calls.

2016-03-06 Thread Ben Finney
"Veek. M" writes: > 1. What are the rules for using __del__ besides: 'don't use it'. What do you mean by “rules”? If you want advice on using that method, I don't think a canonical exhaustive “rules” set exists. For example: Use ‘__del__’ to mark an object as no longer used; don't expect that

Re: __del__: when to use it? What happens when you SystemExit/NameError wrt del? Method vs function calls.

2016-03-06 Thread Chris Angelico
x27;t inherit from Exception, so it's usually left uncaught); the assumption is that all resources will be cleaned up on process termination anyway, so there's no need to run the GC to clean up reference cycles. It's a total waste of effort. > 3. > import foo > def __del__(

__del__: when to use it? What happens when you SystemExit/NameError wrt del? Method vs function calls.

2016-03-06 Thread Veek. M
ferences - why can't we go ahead and call __dell_ and run gc? 3. import foo def __del__(self, foo=foo): foo.bar() What happens here to prevent a NameError? Apparently without the foo=foo a NameError can occur? But why? import foo creates a reference to the object anyways so it's re

Re: NameError: name 'requests' is not defined ?

2014-07-27 Thread Steven D'Aprano
On Mon, 28 Jul 2014 11:52:03 +0800, 水静流深 wrote: > there is a simple file `mydown.py` saved in > `D:\Python34\Lib\site-packages` > there is only one line in mydown.py . > > import requests Just because mydown has imported requests, doesn't mean it is visible everywhere. Each module is a sepa

Re: NameError: name 'requests' is not defined ?

2014-07-27 Thread Miki Tebeka
Greetings, > there is only one line in mydown.py . >   > > import requests   > ... > >>> import mydown > >>> requests.get(url) > > Traceback (most recent call last): > >   File "", line 1, in > > NameError: name 'reque

Re: NameError: name 'requests' is not defined ?

2014-07-27 Thread Dan Stromberg
, '__cached__', '__doc__', '__file__', '__loader__', > '__name__', > '__package__', '__spec__', 'requests'] >>>> url='http://quote.eastmoney.com/hk/0.html?StockCode=0' >

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: NameError: name 'pyver' is not defined

2014-03-06 Thread Pavan Rikhi
On Wed, Mar 05, 2014 at 10:53:46PM -0800, שולמית מירל wrote: > execfile(configfile,globals()) You could replace the above line in cvstop4lib.py with the following: exec(open(configfile).read(), globals()) signature.asc Description: GnuPG Digital Signature -- https://mail.python.org/mailman

Re: NameError: name 'pyver' is not defined

2014-03-06 Thread שולמית מירל
I tried first to run the script under 2.6 version, but than the "argparse" was missing. I couldn't find python 2.7 for unix download -- https://mail.python.org/mailman/listinfo/python-list

Re: NameError: name 'pyver' is not defined

2014-03-06 Thread שולמית מירל
בתאריך יום חמישי, 6 במרץ 2014 10:26:34 UTC+2, מאת Ned Deily: > In article , ?AIOE??OE?I wrote: > 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&quo

Re: NameError: name 'pyver' is not defined

2014-03-06 Thread Ned Deily
In article , Ned Deily wrote: > execfile() no long exists in Python 3 so chances are you are trying to > run a Python 3 program with Python 2. Try running the script explicitly > under Python 2: Er, "trying to run a Python 2 program with Python 3", of course. -- Ned Deily, n...@acm.org -

Re: NameError: name 'pyver' is not defined

2014-03-06 Thread Ned Deily
In article , ?AIOE??OE?I wrote: > 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]

Re: NameError: name 'pyver' is not defined

2014-03-06 Thread Steven D'Aprano
On Wed, 05 Mar 2014 22:53:46 -0800, שולמית מירל wrote: > 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" Sounds like you are

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)

Re: NameError: global name '' is not defined , but a bit differences

2013-09-05 Thread Mohsen Pahlevanzadeh
On Wed, 2013-09-04 at 22:38 -0700, Benjamin Kaplan wrote: > On Wed, Sep 4, 2013 at 9:17 PM, Mohsen Pahlevanzadeh > wrote: > > Dear all , > > > > i get the error : > > > > NameError: global name 'ui' is not defined > > > > Complete questi

Re: NameError: global name '' is not defined , but a bit differences

2013-09-05 Thread Terry Reedy
On 9/5/2013 1:38 AM, Benjamin Kaplan wrote: On Wed, Sep 4, 2013 at 9:17 PM, Mohsen Pahlevanzadeh wrote: i get the error : NameError: global name 'ui' is not defined Complete question is at : http://stackoverflow.com/questions/18627608/nameerror-global-name-is-not-defined-but-d

Re: NameError: global name '' is not defined , but a bit differences

2013-09-04 Thread Benjamin Kaplan
On Wed, Sep 4, 2013 at 9:17 PM, Mohsen Pahlevanzadeh wrote: > Dear all , > > i get the error : > > NameError: global name 'ui' is not defined > > Complete question is at : > http://stackoverflow.com/questions/18627608/nameerror-global-name-is-not-defined-bu

NameError: global name '' is not defined , but a bit differences

2013-09-04 Thread Mohsen Pahlevanzadeh
Dear all , i get the error : NameError: global name 'ui' is not defined Complete question is at : http://stackoverflow.com/questions/18627608/nameerror-global-name-is-not-defined-but-differences Before answering, Thank you for your attention...! Yours, Mohsen -- https://mail.

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

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

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: 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: 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-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

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

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

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-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 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 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 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 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 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 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 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 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 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 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 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
> 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)

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

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: 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-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-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 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

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

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

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__ == &#

Re: NameError: global name 'btn_Matlab' is not defined ?

2010-12-29 Thread Stef Mientki
nt locals()['btn_Matlab'] >> >> > 0x3602d28> > >> >> but if I try to print the button (at exactly the same location), I get >> an error >> >> print btn_Matlab >> >> NameError: global name 'btn_Matlab' is not defined ? &

Re: NameError: global name 'btn_Matlab' is not defined ?

2010-12-28 Thread Steven D'Aprano
o you generate the code? What code is generated? What does it do? > After the code is generated, I can see that the button is created in the > local namespace > >print locals()['btn_Matlab'] > > 0x3602d28> > > > but if I try to print the button (at exactly

NameError: global name 'btn_Matlab' is not defined ?

2010-12-28 Thread Stef Mientki
locals()['btn_Matlab'] > but if I try to print the button (at exactly the same location), I get an error print btn_Matlab NameError: global name 'btn_Matlab' is not defined ? Why isn't the compiler first checking the local namespace ? any clues ? thanks,

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: 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-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-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

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

Re: NameError: how to get the name?

2010-04-24 Thread Yingjie Lan
--- On Sun, 4/25/10, Chris Rebert wrote: > From: Chris Rebert > Subject: Re: NameError: how to get the name? > To: "Yingjie Lan" > Cc: "python list" > Date: Sunday, April 25, 2010, 10:09 AM > On Sat, Apr 24, 2010, Yingjie Lan > > wrote: > > O

Re: NameError: how to get the name?

2010-04-24 Thread Chris Rebert
e: >> >> >> On Sat, 24 Apr 2010, Yingjie Lan wrote: >> >> >>> I wanted to do something like this: >> >> >>> >> >> >>> while True: >> >> >>>   try: >> >> >>>     d

Re: NameError: how to get the name?

2010-04-24 Thread Yingjie Lan
--- On Sun, 4/25/10, Chris Rebert wrote: > From: Chris Rebert > Subject: Re: NameError: how to get the name? > To: "Yingjie Lan" > Cc: python-list@python.org > Date: Sunday, April 25, 2010, 3:27 AM > On Sat, Apr 24, 2010 at 4:17 PM, > Yingjie Lan > wrote: &g

  1   2   3   >