Re: Detect naming typos (AttributeError) in function names

2023-11-07 Thread Thomas Passin via Python-list
On 11/7/2023 2:48 AM, Christian Buhtz via Python-list wrote: Hello Dieter, thanks for your reply. Am 06.11.2023 19:11 schrieb Dieter Maurer: One option is a test suite (--> Python's "unittest" package) with a sufficiently high coverage (near 100 %). Yes, that is the primary goal. But it is f

Re: Detect naming typos (AttributeError) in function names

2023-11-06 Thread Christian Buhtz via Python-list
Hello Dieter, thanks for your reply. Am 06.11.2023 19:11 schrieb Dieter Maurer: One option is a test suite (--> Python's "unittest" package) with a sufficiently high coverage (near 100 %). Yes, that is the primary goal. But it is far away in the related project. I got a hint that "pylint"

Re: Detect naming typos (AttributeError) in function names

2023-11-06 Thread George Fischhof via Python-list
Dieter Maurer via Python-list ezt írta (időpont: 2023. nov. 6., H, 19:13): > c.bu...@posteo.jp wrote at 2023-11-6 12:47 +: > >I would like to know how to detect (e.g. via a linter) typos in function > >names imported from another module. > > One option is a test suite (--> Python's "unittest"

Re: Detect naming typos (AttributeError) in function names

2023-11-06 Thread Dieter Maurer via Python-list
c.bu...@posteo.jp wrote at 2023-11-6 12:47 +: >I would like to know how to detect (e.g. via a linter) typos in function >names imported from another module. One option is a test suite (--> Python's "unittest" package) with a sufficiently high coverage (near 100 %). -- https://mail.python.org/

Detect naming typos (AttributeError) in function names

2023-11-06 Thread Christian Buhtz via Python-list
The function "baR()" does not exist in "foo". This cause an AttributeError when run with a Python interpreter. The described error is not detected in my IDE (Emacs with eglot, pylsp and flake8) and not by flake8 on the shell. Because the involved tools do not look inside the &

Re: AttributeError: 'NoneType' object has no attribute 'get'

2022-01-06 Thread Chris Angelico
On Fri, Jan 7, 2022 at 8:47 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2022-01-06 at 14:21:48 -0700, > Mats Wichmann wrote: > > > And at a more meta level: many functions in the Python world return > > None as an indication that the operation did not succeed. It's useful > > because i

Re: AttributeError: 'NoneType' object has no attribute 'get'

2022-01-06 Thread 2QdxY4RzWzUUiLuE
On 2022-01-06 at 14:21:48 -0700, Mats Wichmann wrote: > And at a more meta level: many functions in the Python world return > None as an indication that the operation did not succeed. It's useful > because in many circumstances None is an "out of band" value - one > that could not happen natura

Re: AttributeError: 'NoneType' object has no attribute 'get'

2022-01-06 Thread Mats Wichmann
kinter\__init__.py", line >> 1705, in __call__ >> return self.func(*args) >> File "D:/Python/Book Bank/New folder/PyCharm/Final/Excel.py", line 57, in >> SaveBook >> e_pissue.get(), >> AttributeError: 'NoneType' object has no att

Re: AttributeError: 'NoneType' object has no attribute 'get'

2022-01-06 Thread Kushal Kumaran
eturn self.func(*args) > File "D:/Python/Book Bank/New folder/PyCharm/Final/Excel.py", line 57, in > SaveBook > e_pissue.get(), > AttributeError: 'NoneType' object has no attribute 'get' > > Process finished with exit code 0 The error means tha

AttributeError: 'NoneType' object has no attribute 'get'

2022-01-05 Thread NArshad
y", line 57, in SaveBook e_pissue.get(), AttributeError: 'NoneType' object has no attribute 'get' Process finished with exit code 0 -- https://mail.python.org/mailman/listinfo/python-list

RE: Vnev issue - AttributeError: module 'sysconfig' has no attribute '_get_default_scheme'. Did you mean: 'get_default_scheme'?

2021-11-10 Thread pranesh kumar
ng How to fix this issue. Thanks in advance Regards Pranesh Kumar 9789411538 Sent from [2]Mail for Windows From: [3]OmPs Sent: 06 November 2021 00:01 To: [4]pranesh kumar Cc: [5]python-list@python.org Subject: Re: Vnev issue - AttributeError: module '

Re: Vnev issue - AttributeError: module 'sysconfig' has no attribute '_get_default_scheme'. Did you mean: 'get_default_scheme'?

2021-11-05 Thread OmPs
pycharm community version 2021.2.2. > >Trying to import Open CV in pycharm but not able to complete > >When creating new virtual environment error I got is "AttributeError: >module 'sysconfig' has no attribute '_get_default_scheme'. Did y

RE: Vnev issue - AttributeError: module 'sysconfig' has no attribute '_get_default_scheme'. Did you mean: 'get_default_scheme'?

2021-11-05 Thread pranesh kumar
Hi Facing problem in creating virtual environment and in importing modules in pycharm community version 2021.2.2. Trying to import Open CV in pycharm but not able to complete When creating new virtual environment error I got is "AttributeError: module 'sysconf

Re: OT: AttributeError

2021-09-29 Thread Greg Ewing
On 30/09/21 7:28 am, dn wrote: Oh yes! The D2 kit - I kept those books for years... https://www.electronixandmore.com/adam/temp/6800trainer/mek6800d2.html My 6800 system was nowhere near as fancy as that! It was the result of replacing the CPU in my homebrew Miniscamp. -- Greg -- https://mai

Re: OT: AttributeError

2021-09-29 Thread Rob Cliffe via Python-list
Ah, Z80s (deep sigh).  Those were the days!  You could disassemble the entire CP/M operating system (including the BIOS), and still have many Kb to play with!  Real programmers don't need gigabytes! On 29/09/2021 03:03, 2qdxy4rzwzuui...@potatochowder.com wrote: On 2021-09-29 at 09:21:34 +1000,

Re: OT: AttributeError

2021-09-29 Thread dn via Python-list
On 29/09/2021 19.16, Greg Ewing wrote: > On 29/09/21 3:03 pm, 2qdxy4rzwzuui...@potatochowder.com wrote: >> Who thinks in little >> endian?  (I was raised on 6502s and 680XX CPUs; 8080s and Z80s always >> did things backwards.) > > The first CPU I wrote code for was a National SC/MP, which doesn't

Re: OT: AttributeError

2021-09-29 Thread MRAB
On 2021-09-29 03:03, 2qdxy4rzwzuui...@potatochowder.com wrote: On 2021-09-29 at 09:21:34 +1000, Chris Angelico wrote: On Wed, Sep 29, 2021 at 9:10 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2021-09-29 at 11:38:22 +1300, > dn via Python-list wrote: > > > For those of us who remember

Re: OT: AttributeError

2021-09-29 Thread Greg Ewing
On 29/09/21 3:03 pm, 2qdxy4rzwzuui...@potatochowder.com wrote: Who thinks in little endian? (I was raised on 6502s and 680XX CPUs; 8080s and Z80s always did things backwards.) The first CPU I wrote code for was a National SC/MP, which doesn't have an endianness, since it never deals with more

Re: OT: AttributeError

2021-09-28 Thread Chris Angelico
On Wed, Sep 29, 2021 at 12:06 PM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > ... Or, even better, to be able to read off a hex dump and see E8 03 > > and instantly read it as "1,000 little-endian". > > 59535 big endian. Warningm flamebait ahead: Who thinks in little > endian? (I was raised o

Re: OT: AttributeError

2021-09-28 Thread 2QdxY4RzWzUUiLuE
On 2021-09-29 at 09:21:34 +1000, Chris Angelico wrote: > ... read off a hex dump and see E8 > 03 and instantly read it as "1,000 little-endian". ITYM 000,1 little-endian. ;-) (Or possibly 000.1, depending on your locale.) -- https://mail.python.org/mailman/listinfo/python-list

Re: OT: AttributeError

2021-09-28 Thread 2QdxY4RzWzUUiLuE
On 2021-09-29 at 09:21:34 +1000, Chris Angelico wrote: > On Wed, Sep 29, 2021 at 9:10 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > > > On 2021-09-29 at 11:38:22 +1300, > > dn via Python-list wrote: > > > > > For those of us who remember/can compute in binary, octal, hex, or > > > decimal a

Re: OT: AttributeError

2021-09-28 Thread Chris Angelico
On Wed, Sep 29, 2021 at 11:59 AM dn via Python-list wrote: > If I hold up two fingers, am I insulting you, or asking for three of > something? > A Roman soldier walked into a bar holding up two fingers. "Five beers, please" ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re: OT: AttributeError

2021-09-28 Thread dn via Python-list
On 29/09/2021 12.21, Chris Angelico wrote: > On Wed, Sep 29, 2021 at 9:10 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: >> >> On 2021-09-29 at 11:38:22 +1300, >> dn via Python-list wrote: >> >>> For those of us who remember/can compute in binary, octal, hex, or >>> decimal as-needed: >>> Why do p

Re: OT: AttributeError

2021-09-28 Thread Chris Angelico
On Wed, Sep 29, 2021 at 10:06 AM Greg Ewing wrote: > > On 29/09/21 12:21 pm, Chris Angelico wrote: > > to the extent that you automatically read 65 and 0x41 as the same > > number. > > Am I too geeky for reading both of them as 'A'? > Not even slightly, and I did deliberately choose a printable A

Re: OT: AttributeError

2021-09-28 Thread Greg Ewing
On 29/09/21 12:21 pm, Chris Angelico wrote: to the extent that you automatically read 65 and 0x41 as the same number. Am I too geeky for reading both of them as 'A'? -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: OT: AttributeError

2021-09-28 Thread Chris Angelico
On Wed, Sep 29, 2021 at 9:10 AM <2qdxy4rzwzuui...@potatochowder.com> wrote: > > On 2021-09-29 at 11:38:22 +1300, > dn via Python-list wrote: > > > For those of us who remember/can compute in binary, octal, hex, or > > decimal as-needed: > > Why do programmers confuse All Hallows'/Halloween for Chr

Re: OT: AttributeError

2021-09-28 Thread 2QdxY4RzWzUUiLuE
On 2021-09-29 at 11:38:22 +1300, dn via Python-list wrote: > For those of us who remember/can compute in binary, octal, hex, or > decimal as-needed: > Why do programmers confuse All Hallows'/Halloween for Christmas Day? That one is also very old. (Yes, I know the answer. No, I will not spoil i

OT: AttributeError

2021-09-28 Thread dn via Python-list
On 29/09/2021 10.50, Stefan Ram wrote: > (For Python programmers who have watched "Game of Thrones".) > > |>>> class girl: > |... pass > |... > |>>> girl = girl() > |>>> print( girl.name ) > |Traceback (most recent call last): &g

Re: AttributeError: module 'itertools' has no attribute 'imap'

2019-08-08 Thread Larry Martell
On Thu, Aug 8, 2019 at 1:33 PM Peter Otten <__pete...@web.de> wrote: > > Larry Martell wrote: > > >> Pyke has been ported to py3. Here is the code that returns the data I > >> am trying to process: > >> > >> return map(self.doctor_answer, it) > >> > >> I don't see anything calling imap. > > > > I g

Re: AttributeError: module 'itertools' has no attribute 'imap'

2019-08-08 Thread Peter Otten
Larry Martell wrote: >> Pyke has been ported to py3. Here is the code that returns the data I >> am trying to process: >> >> return map(self.doctor_answer, it) >> >> I don't see anything calling imap. > > I grepped through the entire pyke code and imap is not in there. Fire up the python3 interp

Re: AttributeError: module 'itertools' has no attribute 'imap'

2019-08-08 Thread Larry Martell
On Thu, Aug 8, 2019 at 12:34 PM Rhodri James wrote: > > On 08/08/2019 17:16, Larry Martell wrote: > > On Thu, Aug 8, 2019 at 11:30 AM Peter Otten <__pete...@web.de> wrote: > >> > >> Larry Martell wrote: > [snip] > >>> But in py3 that fa

Re: AttributeError: module 'itertools' has no attribute 'imap'

2019-08-08 Thread Rhodri James
On 08/08/2019 17:16, Larry Martell wrote: On Thu, Aug 8, 2019 at 11:30 AM Peter Otten <__pete...@web.de> wrote: Larry Martell wrote: [snip] But in py3 that fails with: AttributeError: module 'itertools' has no attribute 'imap' In Python 3 the map() builtin is &

Re: AttributeError: module 'itertools' has no attribute 'imap'

2019-08-08 Thread Larry Martell
vasculopathy_engine = > > > knowledge_engine.engine((rule_base_source_folder, > > > (compiled_rule_base_folder))) > > > with vasculopathy_engine.prove_goal(...) as presentationGen: > > > for vals, plan in presentationGen: > > > > > > But

Re: AttributeError: module 'itertools' has no attribute 'imap'

2019-08-08 Thread Larry Martell
> > with vasculopathy_engine.prove_goal(...) as presentationGen: > > for vals, plan in presentationGen: > > > > But in py3 that fails with: AttributeError: module 'itertools' has no > > attribute 'imap' > > In Python 3 the map() builtin is &q

Re: AttributeError: module 'itertools' has no attribute 'imap'

2019-08-08 Thread MRAB
import knowledge_engine vasculopathy_engine = knowledge_engine.engine((rule_base_source_folder, (compiled_rule_base_folder))) with vasculopathy_engine.prove_goal(...) as presentationGen: for vals, plan in presentationGen: But in py3 that fails with: AttributeError: module 'itertools&#x

Re: AttributeError: module 'itertools' has no attribute 'imap'

2019-08-08 Thread Peter Otten
; > from pyke import knowledge_engine > vasculopathy_engine = > knowledge_engine.engine((rule_base_source_folder, > (compiled_rule_base_folder))) > with vasculopathy_engine.prove_goal(...) as presentationGen: > for vals, plan in presentationGen: > > But in py3 that fails wi

AttributeError: module 'itertools' has no attribute 'imap'

2019-08-08 Thread Larry Martell
= knowledge_engine.engine((rule_base_source_folder, (compiled_rule_base_folder))) with vasculopathy_engine.prove_goal(...) as presentationGen: for vals, plan in presentationGen: But in py3 that fails with: AttributeError: module 'itertools' has no attribute 'imap' I tried conver

Python Flask-CouchDB - AttributeError: '_AppCtxGlobals' object has no attribute 'couch'

2019-05-01 Thread Arup Rakshit
in full_dispatch_request rv = self.dispatch_request() File "/Users/aruprakshit/projects/flask-apps/todo-app/venv/lib/python3.7/site-packages/flask/app.py", line 1799, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/Users/aruprakshit/projects/flask-apps/todo-app/app.py", line 14, in index g.couch['users'] = document File "/Users/aruprakshit/projects/flask-apps/todo-app/venv/lib/python3.7/site-packages/werkzeug/local.py", line 348, in __getattr__ return getattr(self._get_current_object(), name) AttributeError: '_AppCtxGlobals' object has no attribute ‘couch' Can anyone help me to fix this? Thanks, Arup Rakshit a...@zeit.io -- https://mail.python.org/mailman/listinfo/python-list

Re: subprocess : AttributeError: 'Popen' object has no attribute 'read'

2019-01-04 Thread Peter Otten
info.strip('||') > print g_info > print info > fp.close() > Error: > AttributeError: 'Popen' object has no attribute 'read' You have to specify the stream/file, e. g. g_info.stdout.read() but when want both stdout and stderr your rea

Re: subprocess : AttributeError: 'Popen' object has no attribute 'read'

2019-01-04 Thread Chris Angelico
On Fri, Jan 4, 2019 at 10:16 PM wrote: > > On Thursday, January 3, 2019 at 9:40:43 PM UTC+1, Chris Angelico wrote: > > On Fri, Jan 4, 2019 at 7:37 AM Mohan Mohta wrote: > > > I am no expert in python but I found grep is lot faster in than the > > > methods of reading files from python point

Re: subprocess : AttributeError: 'Popen' object has no attribute 'read'

2019-01-04 Thread marco . nawijn
On Thursday, January 3, 2019 at 9:40:43 PM UTC+1, Chris Angelico wrote: > On Fri, Jan 4, 2019 at 7:37 AM Mohan Mohta wrote: > > I am no expert in python but I found grep is lot faster in than the methods > > of reading files from python point me to direction if you know of > > anything faste

Re: subprocess : AttributeError: 'Popen' object has no attribute 'read'

2019-01-03 Thread Chris Angelico
On Fri, Jan 4, 2019 at 7:37 AM Mohan Mohta wrote: > I am no expert in python but I found grep is lot faster in than the methods > of reading files from python point me to direction if you know of > anything faster I would appreciate it. > Try doing things the simple and easy way in Python,

Re: subprocess : AttributeError: 'Popen' object has no attribute 'read'

2019-01-03 Thread Mohan Mohta
On Thursday, January 3, 2019 at 1:49:31 PM UTC-6, Chris Angelico wrote: > On Fri, Jan 4, 2019 at 6:46 AM Mohan Mohta wrote: > > > > Hello, > > I am trying to grep the keyword (which I got from report_file ) from > > report_file > > > > I tried multiple ways but am unable to get it to work. > > H

RE: subprocess : AttributeError: 'Popen' object has no attribute 'read'

2019-01-03 Thread David Raymond
n-list [mailto:python-list-bounces+david.raymond=tomtom@python.org] On Behalf Of Mohan Mohta Sent: Thursday, January 03, 2019 2:44 PM To: python-list@python.org Subject: subprocess : AttributeError: 'Popen' object has no attribute 'read' Hello, I am trying to grep the keyword (w

Re: subprocess : AttributeError: 'Popen' object has no attribute 'read'

2019-01-03 Thread Chris Angelico
On Fri, Jan 4, 2019 at 6:46 AM Mohan Mohta wrote: > > Hello, > I am trying to grep the keyword (which I got from report_file ) from > report_file > > I tried multiple ways but am unable to get it to work. How about, instead, you simply open the file and iterate through it, looking for the keywor

subprocess : AttributeError: 'Popen' object has no attribute 'read'

2019-01-03 Thread Mohan Mohta
g_info=subprocess.Popen('cat report_file| grep -i '+var1, stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True) g_info=g_info.read() g_info=g_info.strip() info=g_info.strip('||') print g_info print info fp.close() Error: AttributeError: &

joblib AttributeError: 'module' object has no attribute

2018-04-14 Thread Ho Yeung Lee
ile "C:\Python27\lib\multiprocessing\pool.py", line 102, in worker task = get() File "C:\Python27\lib\site-packages\joblib\pool.py", line 362, in get return recv() AttributeError: 'module' object has no attribute 'easysearch' how to solve this bug? imp

Re: How to ingore "AttributeError: exception

2017-09-22 Thread Ganesh Pal
> > > is a perfectly good pattern to use. > Thanks looks nice :) > > > > > > > > I am a Linux user on Python 2.7 > > Have you considered moving to Python 3? > Not yet , but Is there something that I need to consider in the current context? Regards, Ganesh -- https://mail.python.org/mailma

Re: How to ingore "AttributeError: exception

2017-09-22 Thread Paul Moore
f not Z_block: >> return False >> >> return Z_block >> >> >> >> >> I have a problem with if and else satement i.e if IF codition fails the >> code would exit with "AttributeError: 'list' object has no attribute

Re: How to ingore "AttributeError: exception

2017-09-22 Thread Thomas Jollans
a problem with if and else satement i.e if IF codition fails the > code would exit with "AttributeError: 'list' object has no attribute > 'data' " error > > Any suggestion on how this can be handled better , Will ignoring the > exceptions in try -except

How to ingore "AttributeError: exception

2017-09-22 Thread Ganesh Pal
data.data[0][0] else: Z_block = disk_object.data.data.di_data[0] if not Z_block: return False return Z_block I have a problem with if and else satement i.e if IF codition fails the code would exit with "AttributeError: 'list' object has no attribu

Re: AttributeError: 'module' object has no attribute 'urlretrieve' in window subsystem ubuntu bash for tensorflow

2017-05-20 Thread Kev Dwyer
n_feature_columns=deep_columns, > dnn_hidden_units=[100, 50]) > > ... > > urllib.urlretrieve(r"/mnt/c/Users/hello/Documents/data.csv", > train_file.name) > urllib.urlretrieve(r"/mnt/c/Users/hello/Documents/dataTest.csv", > test_file.name) > >

AttributeError: 'module' object has no attribute 'urlretrieve' in window subsystem ubuntu bash for tensorflow

2017-05-20 Thread Ho Yeung Lee
a.csv", train_file.name) urllib.urlretrieve(r"/mnt/c/Users/hello/Documents/dataTest.csv", test_file.name) Traceback (most recent call last): File "", line 1, in AttributeError: 'module' object has no attribute 'urlretrieve' -- https://mail.python.org/mailman/listinfo/python-list

today's gotcha: @property and AttributeError

2016-11-12 Thread Cameron Simpson
transmutes internal AttributeErrors into RuntimeErrors. ''' def wrapper(*a, **kw): try: return func(*a, **kw) except AttributeError as e: raise RuntimeError("inner function %s raised %s" % (func, e)) return property(wrapper) I was debugging a cla

Re: AttributeError into a bloc try-except AttributeError

2016-06-12 Thread Vincent Vande Vyvre
icense" for more information. >>> a = None >>> try: ... _ = a.value ... except AttributeError: ... print('OK') ... OK >>> But not in my code: def call_settings_dialog(self): try: _ = self.video.category self.

AttributeError into a bloc try-except AttributeError

2016-06-12 Thread Vincent Vande Vyvre
a = None >>> try: ... _ = a.value ... except AttributeError: ... print('OK') ... OK >>> But not in my code: def call_settings_dialog(self): try: _ = self.video.category self.core.artelive.configure_downloading(self.video)

Re: How to get which attribute causes the AttributeError except inspecting strings?

2016-03-07 Thread Mark Lawrence
On 07/03/2016 16:38, Tim Golden wrote: On 07/03/2016 16:25, Xiang Zhang wrote: Hi, I know I can get the attribute name in some way, but since I just want the attribute name when an AttributeError caused by it raised, I really don't want to inspect the string or introduce one more layer

Re: How to get which attribute causes the AttributeError except inspecting strings?

2016-03-07 Thread Xiang Zhang
On Tuesday, March 8, 2016 at 12:38:31 AM UTC+8, Tim Golden wrote: > On 07/03/2016 16:25, Xiang Zhang wrote: > > Hi, > > > > I know I can get the attribute name in some way, but since I just > > want the attribute name when an AttributeError caused by it raised, I >

Re: How to get which attribute causes the AttributeError except inspecting strings?

2016-03-07 Thread Tim Golden
On 07/03/2016 16:25, Xiang Zhang wrote: > Hi, > > I know I can get the attribute name in some way, but since I just > want the attribute name when an AttributeError caused by it raised, I > really don't want to inspect the string or introduce one more layer > over getatt

Re: How to get which attribute causes the AttributeError except inspecting strings?

2016-03-07 Thread Xiang Zhang
Hi, I know I can get the attribute name in some way, but since I just want the attribute name when an AttributeError caused by it raised, I really don't want to inspect the string or introduce one more layer over getattr. I hope I can get the attribute which causes the exception fro

Re: How to get which attribute causes the AttributeError except inspecting strings?

2016-03-07 Thread jmp
On 03/07/2016 09:46 AM, ZhangXiang wrote: In python3, when I write code like this: try: fields = [getattr(Product, field) for field in fields.split(',')] except AttributeError as e: raise HTTPError(...) I want to raise a new type of error giving a string telling the

Re: How to get which attribute causes the AttributeError except inspecting strings?

2016-03-07 Thread Xiang Zhang
On Monday, March 7, 2016 at 5:49:48 PM UTC+8, Peter Otten wrote: > ZhangXiang wrote: > > > In python3, when I write code like this: > > > > try: > > fields = [getattr(Product, field) for field in fields.split(',')] > > except AttributeError as e

Re: How to get which attribute causes the AttributeError except inspecting strings?

2016-03-07 Thread Peter Otten
ZhangXiang wrote: > In python3, when I write code like this: > > try: > fields = [getattr(Product, field) for field in fields.split(',')] > except AttributeError as e: > raise HTTPError(...) > > I want to raise a new type of error giving a string tel

How to get which attribute causes the AttributeError except inspecting strings?

2016-03-07 Thread ZhangXiang
In python3, when I write code like this: try: fields = [getattr(Product, field) for field in fields.split(',')] except AttributeError as e: raise HTTPError(...) I want to raise a new type of error giving a string telling the user which attribute is not valid. But I don't

Re: Extra AttributeError inside property - possible bug ?

2015-09-01 Thread Peter Otten
dunric...@gmail.com wrote: > Hello, > > bellow is a simple Python2 example of a class which defines __getattr__ > method and a property, where AttributeError exception is raised: > > from __future__ import print_function > > class MyClass(object): >

Extra AttributeError inside property - possible bug ?

2015-08-31 Thread dunric29a
Hello, bellow is a simple Python2 example of a class which defines __getattr__ method and a property, where AttributeError exception is raised: from __future__ import print_function class MyClass(object): def __getattr__(self, name): print('__getattr__ <<', nam

Re: AttributeError: 'module' object has no attribute '__path__'

2015-08-31 Thread Chris Angelico
On Tue, Sep 1, 2015 at 1:32 PM, Rustom Mody wrote: > On Tuesday, September 1, 2015 at 3:46:15 AM UTC+5:30, Laura Creighton wrote: >> Can you make the effort to move your cursor to the bottom of >> the mail you are replying to, before you start typing, >> so that your reply comes after what was sai

Re: AttributeError: 'module' object has no attribute '__path__'

2015-08-31 Thread Rustom Mody
On Tuesday, September 1, 2015 at 3:46:15 AM UTC+5:30, Laura Creighton wrote: > Can you make the effort to move your cursor to the bottom of > the mail you are replying to, before you start typing, > so that your reply comes after what was said before, instead of > first thing, and thus before what

Re: AttributeError: 'module' object has no attribute '__path__'

2015-08-31 Thread Laura Creighton
In a message of Mon, 31 Aug 2015 17:01:07 -0400, Saran Ahluwalia writes: >Laura, > >It does not appear to be the case. I actually had to actually unset the >PYTHONPATH. > >Thanks for your suggestion. > >Sincerely, >Saran Are you and kbtyo the same person? If deleting your PYTHONPATH fixed it, th

Re: AttributeError: 'module' object has no attribute '__path__'

2015-08-31 Thread Saran Ahluwalia
Laura, It does not appear to be the case. I actually had to actually unset the PYTHONPATH. Thanks for your suggestion. Sincerely, Saran On Mon, Aug 31, 2015 at 4:17 PM, Laura Creighton wrote: > Check and see if you have a file in your working directory with the > very same name as a module yo

Re: AttributeError: 'module' object has no attribute '__path__'

2015-08-31 Thread Laura Creighton
Check and see if you have a file in your working directory with the very same name as a module you are trying to import, or the_same_name.py If so, change the name of that file to something else. Laura -- https://mail.python.org/mailman/listinfo/python-list

AttributeError: 'module' object has no attribute '__path__'

2015-08-31 Thread kbtyo
well. I am not sure where to start modifying the path and fear that I will break my initial setup. I welcome feedback on next steps. --- AttributeErrorTraceback (most recent call last) C:\Program

Re: Exception AttributeError: "'NoneType' object has no attribute 'population'"

2015-08-24 Thread MRAB
On 2015-08-24 06:49, 344276105 wrote: Hi all, I am a python learner. I encountered a problem when i was testing the following code. What is strange is that if I replace the object name with zhang, the program would be ok. And if I replace the Person.population with self.__class__.population, it w

Exception AttributeError: "'NoneType' object has no attribute 'population'"

2015-08-24 Thread 344276105
Hi all, I am a python learner. I encountered a problem when i was testing the following code. What is strange is that if I replace the object name with zhang, the program would be ok. And if I replace the Person.population with self.__class__.population, it will also be ok. So what is the matter

Re: AttributeError

2015-08-14 Thread Ben Finney
Ltc Hotspot writes: > So calling people stupid and ignorant on the internet makes you sexual > arousal and to masturbate with yourself With that, you have worn out your welcome here. Please don't post here again until you can refrain from puerile demeaning insults. -- \ “Alternative e

Re: AttributeError

2015-08-13 Thread Denis McMahon
On Thu, 13 Aug 2015 02:41:55 -0700, Ltc Hotspot wrote: >>> How do I define X? > What are the values of X & Y from the code as follows: > # print time: ['From', 'stephen.marqu...@uct.ac.za', 'Sat', 'Jan', '5', '09:14:16', '2008'] This is the data you need to look at. X is the position in the p

Re: AttributeError

2015-08-13 Thread Ltc Hotspot
On Thu, Aug 13, 2015 at 2:15 AM, Denis McMahon wrote: > On Wed, 12 Aug 2015 16:46:32 -0700, Ltc Hotspot wrote: > >> How do I define X? >> > - >> Traceback reads: >> >> 10 f = open(filename,'r') >> 11 for

Re: AttributeError

2015-08-13 Thread Mark Lawrence
On 12/08/2015 22:04, Ltc Hotspot wrote: So calling people stupid and ignorant on the internet makes you sexual arousal and to masturbate with yourself *plonk* - please follow suit everybody, it's quite clear that he has no interest in bothering with any of the data we've all provided. -- My

Re: AttributeError

2015-08-13 Thread Denis McMahon
On Wed, 12 Aug 2015 16:46:32 -0700, Ltc Hotspot wrote: > How do I define X? > - > Traceback reads: > > 10 f = open(filename,'r') > 11 for l in f: > ---> 12 h = int(l.split()[X].split(':')[Y]) >

Re: AttributeError

2015-08-13 Thread Ltc Hotspot
So calling people stupid and ignorant on the internet makes you sexual arousal and to masturbate with yourself On Wed, Aug 12, 2015 at 1:38 PM, Denis McMahon wrote: > On Wed, 12 Aug 2015 12:05:37 -0700, Ltc Hotspot wrote: > >>>Have a look at assignment_10_2_v_06.py. > >> What should I look at ass

Re: AttributeError

2015-08-12 Thread MRAB
On 2015-08-13 00:46, Ltc Hotspot wrote: >> How do I define the file name in order to remove the traceback? >> > At this point I think I'll just let you figure that out for yourself... > > -- > https://mail.python.org/mailman/listinfo/python-list MRAB, How do I define X?

Re: AttributeError

2015-08-12 Thread Ltc Hotspot
>> How do I define the file name in order to remove the traceback? >> > At this point I think I'll just let you figure that out for yourself... > > -- > https://mail.python.org/mailman/listinfo/python-list MRAB, How do I define X? --

Re: AttributeError

2015-08-12 Thread MRAB
On 2015-08-13 00:05, Ltc Hotspot wrote: On Wed, Aug 12, 2015 at 3:35 PM, MRAB wrote: > On 2015-08-12 22:16, Denis McMahon wrote: > [snip] > >> c = [0 for i in range(24)] >> f = open(filename,'r') >> for l in f: >> h = int(l.strip().split()[X].split(':')[Y]) >> c[h] = c[h] + 1 >> f.clos

Re: AttributeError

2015-08-12 Thread Emile van Sebille
On 8/12/2015 4:05 PM, Ltc Hotspot wrote: On Wed, Aug 12, 2015 at 3:35 PM, MRAB wrote: On 2015-08-12 22:16, Denis McMahon wrote: [snip] c = [0 for i in range(24)] f = open(filename,'r') for l in f: h = int(l.strip().split()[X].split(':')[Y]) c[h] = c[h] + 1 f.close() for i in range

Re: AttributeError

2015-08-12 Thread Ltc Hotspot
On Wed, Aug 12, 2015 at 3:35 PM, MRAB wrote: > On 2015-08-12 22:16, Denis McMahon wrote: > [snip] > >> c = [0 for i in range(24)] >> f = open(filename,'r') >> for l in f: >> h = int(l.strip().split()[X].split(':')[Y]) >> c[h] = c[h] + 1 >> f.close() >> for i in range(24): >> print '

Re: AttributeError

2015-08-12 Thread MRAB
On 2015-08-12 22:16, Denis McMahon wrote: [snip] c = [0 for i in range(24)] f = open(filename,'r') for l in f: h = int(l.strip().split()[X].split(':')[Y]) c[h] = c[h] + 1 f.close() for i in range(24): print '{:02d} {}'.format(i, c[i]) There's no need to strip whitespace just bef

Re: AttributeError

2015-08-12 Thread Mark Lawrence
On 12/08/2015 23:02, Ltc Hotspot wrote: FOR GOD'S SAKE WILL YOU PLEASE STOP TOP POSTING AND TRIM DOWN YOUR REPLIES. WHAT GRADE DO YOU EXPECT, A Z-? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence -- https://mail.python.

Re: AttributeError

2015-08-12 Thread Ltc Hotspot
The problem here is that these are home work assignment and to code an else word assignment would be in contradiction to the academic curriculum. Specifically, I want to deploy a quick and simply dic solution: Revised code: c = [0 for i in range(24)] filename = raw_input("Enter file name: ") f =

Re: AttributeError

2015-08-12 Thread Mark Lawrence
On 12/08/2015 22:32, Emile van Sebille wrote: @ltc -- read this -- then re-read all the responses you've been given. Repeat ad nauseam. Until you can understand and incorporate advice given you're wasting your time and ours asking. This question has been asked on *THREE* different Python mai

Re: AttributeError

2015-08-12 Thread Mark Lawrence
On 12/08/2015 22:15, Clayton Kirkwood wrote: I'm thinking we are being played by a Turing type machine. crk Will you please stop top posting, how many times do people have to be asked until the message gets through? -- My fellow Pythonistas, ask not what our language can do for you, ask wh

Re: AttributeError

2015-08-12 Thread Emile van Sebille
On 8/12/2015 1:38 PM, Denis McMahon wrote: On Wed, 12 Aug 2015 12:05:37 -0700, Ltc Hotspot wrote: Have a look at assignment_10_2_v_06.py. What should I look at assignment_10_2_v_06.py.: You shouldn't. You should instead approach your tutor and tell him you are too stupid to learn computer

Re: AttributeError

2015-08-12 Thread Gene Heskett
On Wednesday 12 August 2015 15:05:37 Ltc Hotspot wrote: > >Have a look at assignment_10_2_v_06.py. > > What should I look at assignment_10_2_v_06.py.: > > > handle = """From stephen.marqu...@uct.ac.za Sat Jan 5 09:14:16 2008 > From lo...@media.berkeley.edu Fri Jan 4 18:10:48 2008 > """.split("\n

Re: AttributeError

2015-08-12 Thread Denis McMahon
On Wed, 12 Aug 2015 11:35:03 -0700, Ltc Hotspot wrote: > How do I define time in the revised code ? I'm guessing that you have a line of input like: word word word timestamp word word word word and that timestamp looks something like: hh:mm:ss Start of by defining a list with 24 elements all

RE: AttributeError

2015-08-12 Thread Clayton Kirkwood
on.org > Subject: Re: AttributeError > > On Wed, 12 Aug 2015 12:05:37 -0700, Ltc Hotspot wrote: > > >>Have a look at assignment_10_2_v_06.py. > > > What should I look at assignment_10_2_v_06.py.: > > You shouldn't. You should instead approach your tutor and tell h

Re: AttributeError

2015-08-12 Thread Mark Lawrence
On 12/08/2015 21:28, Denis McMahon wrote: On Wed, 12 Aug 2015 09:29:50 -0700, Ltc Hotspot wrote: Using the attached file of a diagram as a frame, why is there an attribute message? Perhaps you should read the message. It's very clear. Not to Ltc Hotspot. I'm unsure as to whether he's sim

Re: AttributeError

2015-08-12 Thread Denis McMahon
On Wed, 12 Aug 2015 12:05:37 -0700, Ltc Hotspot wrote: >>Have a look at assignment_10_2_v_06.py. > What should I look at assignment_10_2_v_06.py.: You shouldn't. You should instead approach your tutor and tell him you are too stupid to learn computer programming[1], and can you please transfer

Re: AttributeError

2015-08-12 Thread Denis McMahon
On Wed, 12 Aug 2015 09:29:50 -0700, Ltc Hotspot wrote: > Using the attached file of a diagram as a frame, why is there an > attribute message? Perhaps you should read the message. It's very clear. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-li

Re: AttributeError

2015-08-12 Thread MRAB
On 2015-08-12 20:05, Ltc Hotspot wrote: >Have a look at assignment_10_2_v_06.py. What should I look at assignment_10_2_v_06.py.: How "time" is defined! handle = """From stephen.marqu...@uct.ac.za Sat Jan 5 09:14:16 2008 >From lo...@media.berkeley.edu Fri Jan 4 18:10:48 2008 """.split("\n")

Re: AttributeError

2015-08-12 Thread Ltc Hotspot
>Have a look at assignment_10_2_v_06.py. What should I look at assignment_10_2_v_06.py.: handle = """From stephen.marqu...@uct.ac.za Sat Jan 5 09:14:16 2008 >From lo...@media.berkeley.edu Fri Jan 4 18:10:48 2008 """.split("\n") # Snippet file data: mbox-short.txt count = dict() #fname = raw_i

Re: AttributeError

2015-08-12 Thread MRAB
On 2015-08-12 19:35, Ltc Hotspot wrote: Emile How do I define time in the revised code ? Have a look at assignment_10_2_v_06.py. --- Traceback Message reads: In [66]: %run assignment_10_2_v_07 NameError Traceback (most

  1   2   3   4   >