I have copied an example of an editable ListCtrl from http://www.blog.pythonlibrary.org/2011/01/04/wxpython-wx-listctrl-tips-and-tricks/ . I have changed InsertStringItem and SetStringItem to InsertItem and SetItem. When I try to run this I get the following error
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\wx\lib\mixins\listctrl.py", line 560, in OnLeftDown
self.OpenEditor(col, row)
File "C:\Python27\lib\site-packages\wx\lib\mixins\listctrl.py", line 568, in OpenEditor
evt.Index = row
AttributeError: can't set attribute
I am using Python 2.7.10 on Windows 10.
How do I fix this?
Related
I keep getting the error listed below. The problem isn't that there's an error. It's that the segment of code that is throwing the error no longer exists. I modified it to address the error. It now calls a method .cooridnates() rather than the propery .extent, but it seems to keep running the old code some how (shown in bold). I tried swapping out my IDE and restarting the machine, but still nothing. It's not currently tracked in a repo. So I'm out of ideas. It's a windows 10 machine.
Traceback (most recent call last):
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\PGE_Pro_Py3\lib\site-packages\arcgis\geometry\_types.py", line 183, in __getattr__
return self.__getitem__(name)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\PGE_Pro_Py3\lib\site-packages\arcgis\geometry\_types.py", line 190, in __getitem__
return dict.__getitem__(self, k)
KeyError: 'extent'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File \\rcnas01-smb\NRM_DataTeam\e_Scripts\~DS\Defensible_space_pre_inspection_form_export_2022_20211029.py, line 192, in <module>
map_server_response = temp.site_map(item_webmap, 'Asset Centroid', "ASSET_NAME = '{}'".format(which_one))
File \\rcnas01-smb\NRM_DataTeam\e_Scripts\template_fxn.py, line 154, in site_map
**extent = sdf_zoomer.spatial.bbox.buffer(400).extent**
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\PGE_Pro_Py3\lib\site-packages\arcgis\geometry\_types.py", line 186, in __getattr__
"'%s' object has no attribute '%s'" % (type(self).__name__, name)
AttributeError: 'Geometry' object has no attribute 'extent'
Thanks everyone for the replies. I figured out the issue. Some how an old copy of the imported function library was saved in another directory that was also appended in. The program refenerced the first appended path with the old file first. So as I update the script the program continue to used the old copy.
I'm planning to use the Language-check module for python 3 in my poem making code. I was just testing it with
import language_tool
lang_tool = language_tool.LanguageTool("en-US")
text = "A sentence with a error in the Hitchhiker’s Guide tot he Galaxy"
matches = lang_tool.check(text)
print(len(matches))
but it gave me this error.
Traceback (most recent call last):
File "/home/runner/.site-packages/language_tool/__init__.py", line 548, in get_server_cmd
cmd = cache["server_cmd"]
KeyError: 'server_cmd'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/runner/.site-packages/language_tool/__init__.py", line 559, in get_jar_info
java_path, jar_path = cache["jar_info"]
KeyError: 'jar_info'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 10, in <module>
lang_tool = language_tool.LanguageTool("en-US")
File "/home/runner/.site-packages/language_tool/__init__.py", line 188, in __init__
self._start_server_on_free_port()
File "/home/runner/.site-packages/language_tool/__init__.py", line 323, in _start_server_on_free_port
cls._start_server()
File "/home/runner/.site-packages/language_tool/__init__.py", line 335, in _start_server
server_cmd = get_server_cmd(cls._port)
File "/home/runner/.site-packages/language_tool/__init__.py", line 550, in get_server_cmd
java_path, jar_path = get_jar_info()
File "/home/runner/.site-packages/language_tool/__init__.py", line 563, in get_jar_info
raise JavaError("can’t find Java")
language_tool.JavaError: can’t find Java
I've looked at some similar questions and I know I probably need to put something in 'Path' but I don't know what specifically to enter. Thanks for your help!
Also I'm on doing this on repl.it, not IDLE.
Note: I'm adding this as an actual answer because the question was resolved in the comments.
Your question says:
Also I'm on doing this on repl.it, not IDLE.
That means that you need to install this module and all its prerequisites into your repl.it environment, not into your local machine.
On the BitBucket link you provided, under "Prerequisites", the page says:
LanguageTool requires Java 6 or later.
So you will need to ensure Java is installed into your repl.it environment somehow. I don't know whether that is possible or not. Alternatively, you can simply install this package and all its prerequisites locally instead.
The InstanceEditor demo example at Enthought GitHub Repository raises the following exception:
Traceback (most recent call last):
File "C:\Users\jgv\AppData\Local\Programs\Python\Python36\lib\site-packages\traitsui\ui.py", line 232, in dispose
self.result = result
File "C:\Users\jgv\AppData\Local\Programs\Python\Python36\lib\site-packages\traits\trait_handlers.py", line 172, in error
value )
traits.trait_errors.TraitError: The 'result' trait of an UI instance must be a boolean, but a value of <PyQt4.QtCore.QObject object at 0x000001EA249AEB88> <class 'PyQt4.QtCore.QObject'> was specified.
Traceback (most recent call last):
File "C:\Users\jgv\AppData\Local\Programs\Python\Python36\lib\site-packages\traitsui\ui.py", line 232, in dispose
self.result = result
File "C:\Users\jgv\AppData\Local\Programs\Python\Python36\lib\site-packages\traits\trait_handlers.py", line 172, in error
value )
traits.trait_errors.TraitError: The 'result' trait of an UI instance must be a boolean, but a value of <PyQt4.QtCore.QObject object at 0x000001EA249AEB88> <class 'PyQt4.QtCore.QObject'> was specified.
when the user interface is used to specify a trait setting.
My system is: Python 3.6.0, traits 4.6.0, PyQt4-4.11.4, and Microsoft Windows 10.
I would appreciate suggestions on how to fix this.
Thanks.
For the record: issue filed and being discussed at https://github.com/enthought/traitsui/issues/331
I have this problem with Spyder(in Windows 10). When I try to do anything on my spyder console (even something as simple as 1+1), I get the following error message in the internal console tab:
(Any help will be appreciated)
Traceback (most recent call last): <br> <br>
File "C:\Users\ JohnDoe \Anaconda2\lib\site-packages\qtconsole\base_frontend_mixin.py", line 163, in _dispatch<br><br>
Traceback (most recent call last):<br><br>
File "C:\Users\ JohnDoe \Anaconda2\lib\site-packages\qtconsole\base_frontend_mixin.py", line 163, in _dispatch<br><br>
handler(msg)<br><br>
File "C:\Users\JohnDoe\Anaconda2\lib\site-packages\spyder\widgets\ipythonconsole\namespacebrowser.py", line 188, in _handle_execute_reply<br><br>
self.handle_exec_method(msg)<br><br>
File "C:\Users\ JohnDoe\Anaconda2\lib\site-packages\spyder\widgets\ipythonconsole\shell.py", line 225, in handle_exec_method<br><br>
properties = ast.literal_eval(data['text/plain'])<br><br>
KeyError: 'text/plain'<br><br>
handler(msg)<br><br>
File "C:\Users\ JohnDoe\Anaconda2\lib\site-packages\spyder\widgets\ipythonconsole\namespacebrowser.py", line 188, in _handle_execute_reply<br><br>
self.handle_exec_method(msg)<br><br>
File "C:\Users\ JohnDoe\Anaconda2\lib\site-packages\spyder\widgets\ipythonconsole\shell.py", line 222, in handle_exec_method<br><br>
view = ast.literal_eval(data['text/plain'])<br><br>
KeyError: 'text/plain'
The problem gets resolved when you install Spyder 3 like Carlos mentioned
This error was fixed in Spyder 3.0.2. Please update to that version.
However, it actually does not impacts my codes or run times. The only drawback is that you cannot test your codes out on the machines which shows this error.
I am trying to use the cassandrapython cqlengine for accessing the cassandra db, I was able to filter when the columns are not of list type.
I get the following error message :
d =cClass().filter(lastname='text',age=2,input__contains='a')
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/cqlengine-0.21.0-py3.4.egg/cqlengine/operators.py", line 43,
in get_operator KeyError: 'CONTAINS' During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/dist-packages/cqlengine-0.21.0-py3.4.egg/cqlengine/models.py", line 562, in filter
File "/usr/local/lib/python3.4/dist-packages/cqlengine-0.21.0-py3.4.egg/cqlengine/query.py", line 507, in filter
File "/usr/local/lib/python3.4/dist-packages/cqlengine-0.21.0-py3.4.egg/cqlengine/operators.py", line 45,
in get_operator **cqlengine.operators.QueryOperatorException: contains doesn't map to a QueryOperator**
It looks like you're using a very old (and deprecated) version of cqlengine. If you can, upgrade to the version integrated with the DataStax driver, where the API has supported contains since version 3.1.0.