When I want to import clr, then My kivy env got crashed.
Traceback (most recent call last):
File "demo.py", line 86, in <module>
demoApp().run()
File "C:\Python27\lib\site-packages\kivy\app.py", line 801, in run
self.load_kv(filename=self.kv_file)
File "C:\Python27\lib\site-packages\kivy\app.py", line 598, in load_kv
root = Builder.load_file(rfilename)
File "C:\Python27\lib\site-packages\kivy\lang\builder.py", line 301, in load_file
return self.load_string(data, **kwargs)
File "C:\Python27\lib\site-packages\kivy\lang\builder.py", line 379, in load_string
widget = Factory.get(parser.root.name)()
File "C:\Python27\lib\site-packages\kivy\factory.py", line 139, in __getattr__
module = __import__(name=item['module'], fromlist='.')
TypeError: __import__() takes at least 1 argument (0 given)
Could anyone help me with this? Thanks.
Related
I am developing a code where I need to create a Manager to synchronize a Queue. In the project I am using hydra and everything works fine until I create a multiprocessing Manager Object. This is the raised error with HYDRA_FULL_ERROR=1:
Primary config module 'config' not found.
Check that it's correct and contains an __init__.py file
Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
Traceback (most recent call last):
File "mre.py", line 8, in <module>
main()
File "C:\Users\UX331U\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\hydra\main.py", line 32, in decorated_main
_run_hydra(
File "C:\Users\UX331U\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\hydra\_internal\utils.py", line 355, in _run_hydra
run_and_report(
File "C:\Users\UX331U\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\hydra\_internal\utils.py", line 207, in run_and_report
return func()
File "C:\Users\UX331U\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\hydra\_internal\utils.py", line 356, in <lambda>
lambda: hydra.run(
File "C:\Users\UX331U\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\hydra\_internal\hydra.py", line 107, in run
return run_job(
File "C:\Users\UX331U\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\hydra\core\utils.py", line 125, in run_job
ret.return_value = task_function(task_cfg)
File "mre.py", line 7, in main
m = Manager()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\multiprocessing\context.py", line 57, in Manager
m.start()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\multiprocessing\managers.py", line 583, in start
self._address = reader.recv()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\multiprocessing\connection.py", line 250, in recv
buf = self._recv_bytes()
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\multiprocessing\connection.py", line 305, in _recv_bytes
waitres = _winapi.WaitForMultipleObjects(
KeyboardInterrupt
^C
C:\Users\UX331U\Desktop>SET HYDRA_FULL_ERROR=1
C:\Users\UX331U\Desktop>python mre.py
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\multiprocessing\spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\multiprocessing\spawn.py", line 125, in _main
prepare(preparation_data)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\multiprocessing\spawn.py", line 236, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
main_content = runpy.run_path(main_path,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 265, in run_path
return _run_module_code(code, init_globals, run_name,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 97, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2800.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\UX331U\Desktop\mre.py", line 8, in <module>
main()
File "C:\Users\UX331U\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\hydra\main.py", line 32, in decorated_main
_run_hydra(
File "C:\Users\UX331U\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\hydra\_internal\utils.py", line 355, in _run_hydra
run_and_report(
File "C:\Users\UX331U\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\hydra\_internal\utils.py", line 210, in run_and_report
raise ex
File "C:\Users\UX331U\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\hydra\_internal\utils.py", line 207, in run_and_report
return func()
File "C:\Users\UX331U\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\hydra\_internal\utils.py", line 356, in <lambda>
lambda: hydra.run(
File "C:\Users\UX331U\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\hydra\_internal\hydra.py", line 100, in run
cfg = self.compose_config(
File "C:\Users\UX331U\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\hydra\_internal\hydra.py", line 505, in compose_config
self.config_loader.ensure_main_config_source_available()
File "C:\Users\UX331U\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\hydra\_internal\config_loader_impl.py", line 135, in ensure_main_config_source_available
self.missing_config_error(
File "C:\Users\UX331U\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\hydra\_internal\config_loader_impl.py", line 109, in missing_config_error
raise MissingConfigException(
hydra.errors.MissingConfigException: Primary config module 'config' not found.
Check that it's correct and contains an __init__.py file
I also attach a minimal code snippet to reproduce the error.
import hydra
from multiprocessing import Manager
#hydra.main(config_path='config', config_name='config')
def main(cfg):
m = Manager() # The error is in this line
m.Queue()
main()
The config.yaml is correctly created and located since when I don't use the Manager, the entire code works with no errors:
- PROJECT ----- config ---- config.yaml
|
|
----- main.py
As far as I have understood, the problem comes from the fact that hydra changes the directory when initialized and afterwards, when the Manager is created, hydra is called again to be initialized but as the directory has been changed, it can not find the config folder. If this is true, is it a bug or can it be solved?
Thank you so much for your help.
I'm not able to reproduce the error on my machine.
You can stop hydra from changing directories at runtime by passing hydra.job.chdir=False at the command line -- see the docs on how to disable changing current working dir to job's output dir.
python main.py hydra.job.chdir=False
I'm trying to use the Python Processing port by Abhik Pal and Manindra Mohrarna. It seems to work fine, but it gives lots of warnings and errors and it really bothers me.
WARNING: Traceback (most recent call last):
File "C:\Users\gabri\Documents\Programmazione\Python\p5Sketchbook\test.py", line 10, in <module>
run()
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\p5\sketch\userspace.py", line 155, in run
p5.sketch = Sketch(setup_method, draw_method, handlers, frame_rate)
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\p5\sketch\base.py", line 60, in __init__
app.Canvas.__init__(
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\app\canvas.py", line 211, in __init__
self.create_native()
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\app\canvas.py", line 228, in create_native
self._app.backend_module.CanvasBackend(self, **self._backend_kwargs)
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\app\backends\_glfw.py", line 298, in __init__
self._on_resize(self._id, size[0], size[1])
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\app\backends\_glfw.py", line 394, in _on_resize
self._vispy_canvas.events.resize(
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\util\event.py", line 453, in __call__
self._invoke_callback(cb, event)
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\util\event.py", line 471, in _invoke_callback
_handle_exception(self.ignore_callback_errors,
<< caught exception here: >>
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\util\event.py", line 469, in _invoke_callback
cb(event)
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\p5\sketch\base.py", line 157, in on_resize
p5.renderer.reset_view()
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\p5\sketch\renderer2d.py", line 82, in reset_view
self.texture_prog['modelview'] = self.modelview_matrix.T.flatten()
TypeError: 'NoneType' object does not support item assignment
ERROR: Invoking <bound method Sketch.on_resize of <Sketch (Glfw) at 0x1fba232bfd0>> for ResizeEvent
Exception ignored on calling ctypes callback function: <function CanvasBackend._on_close at 0x000001FBA2375EA0>
Traceback (most recent call last):
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\glfw\__init__.py", line 660, in callback_wrapper
return func(*args, **kwargs)
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\app\backends\_glfw.py", line 400, in _on_close
self._vispy_canvas.close()
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\app\canvas.py", line 463, in close
self.events.close()
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\util\event.py", line 453, in __call__
self._invoke_callback(cb, event)
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\vispy\util\event.py", line 469, in _invoke_callback
cb(event)
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\p5\sketch\base.py", line 148, in on_close
exit()
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\_sitebuiltins.py", line 26, in __call__
raise SystemExit(code)
SystemExit: None
Traceback (most recent call last):
File "C:\Users\gabri\Documents\Programmazione\Python\p5Sketchbook\test.py", line 10, in <module>
run()
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\p5\sketch\userspace.py", line 167, in run
exit()
File "C:\Users\gabri\AppData\Local\Programs\Python\Python310\lib\site-packages\p5\sketch\userspace.py", line 250, in exit
p5.exit(*args, **kwargs)
AttributeError: module 'p5.core.p5' has no attribute 'exit'
Process returned 1 (0x1) execution time : 20.330 s
What does this mean? Why does it happen and is there a way to fix this?
I run the python code from the root. Shows an error when I just imported the module:
ERROR : Traceback (most recent call last):
File "/home/amir/photo.py", line 4, in <module>
import pyautogui as gui
File "/usr/local/lib/python3.9/dist-packages/pyautogui/__init__.py", line 249, in <module>
import mouseinfo
File "/usr/local/lib/python3.9/dist-packages/mouseinfo/__init__.py", line 223, in <module>
_display = Display(os.environ['DISPLAY'])
File "/usr/local/lib/python3.9/dist-packages/Xlib/display.py", line 80, in __init__
self.display = _BaseDisplay(display)
File "/usr/local/lib/python3.9/dist-packages/Xlib/display.py", line 62, in __init__
display.Display.__init__(*(self, ) + args, **keys)
File "/usr/local/lib/python3.9/dist-packages/Xlib/protocol/display.py", line 129, in __init__
raise error.DisplayConnectionError(self.display_name, r.reason)
Xlib.error.DisplayConnectionError: Can't connect to display ":1": b'No protocol specified\n'
Colleague provided me set of py files for testing, which are running fine on his machine. However when I run the py files, I am getting following error:
Traceback (most recent call last):
File "D:\workspaces\pyworkspace\Analytics Python\python_server\server1.py", line 84, in <module>
start_server()
File "D:\workspaces\pyworkspace\Analytics Python\python_server\server1.py", line 57, in start_server
socketObj.bind(server_address)
LookupError: unknown encoding: idna
Here, it says to add import encodings.idna. So I added that import (even though eclipse says "unused import"), but still getting the same error. So I put some breakpoints and started up debugging, but debugger didnt hit the breakpoints. The program termniates without hitting any breakpoints giving following error:
pydev debugger: starting (pid: 8316)
Traceback (most recent call last):
File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 741, in _pydevd_bundle.pydevd_cython_win32_34_64.PyDBFrame.trace_dispatch (_pydevd_bundle/pydevd_cython_win32_34_64.c:15515)
File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 254, in _pydevd_bundle.pydevd_cython_win32_34_64.PyDBFrame.do_wait_suspend (_pydevd_bundle/pydevd_cython_win32_34_64.c:5631)
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 764, in do_wait_suspend
self._activate_mpl_if_needed()
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 416, in _activate_mpl_if_needed
activate_function()
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 407, in <lambda>
self.mpl_modules_for_patching = {"matplotlib": lambda: activate_matplotlib(do_enable_gui),
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydev_ipython\matplotlibtools.py", line 93, in activate_matplotlib
is_interactive = is_interactive_backend(backend)
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydev_ipython\matplotlibtools.py", line 56, in is_interactive_backend
from matplotlib.rcsetup import interactive_bk, non_interactive_bk # #UnresolvedImport
ImportError: cannot import name 'interactive_bk'
Traceback (most recent call last):
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 1621, in <module>
main()
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 1615, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 1022, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\_pydev_imps\_pydev_execfile.py", line 25, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "D:\Mahesh\workspaces\pyworkspace\Analytics Python\python_server\server.py", line 84, in <module>
start_server()
File "D:\Mahesh\workspaces\pyworkspace\Analytics Python\python_server\server.py", line 84, in <module>
start_server()
File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 982, in _pydevd_bundle.pydevd_cython_win32_34_64.SafeCallWrapper.__call__ (_pydevd_bundle/pydevd_cython_win32_34_64.c:19346)
File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 498, in _pydevd_bundle.pydevd_cython_win32_34_64.PyDBFrame.trace_dispatch (_pydevd_bundle/pydevd_cython_win32_34_64.c:18639)
File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 750, in _pydevd_bundle.pydevd_cython_win32_34_64.PyDBFrame.trace_dispatch (_pydevd_bundle/pydevd_cython_win32_34_64.c:15669)
File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 741, in _pydevd_bundle.pydevd_cython_win32_34_64.PyDBFrame.trace_dispatch (_pydevd_bundle/pydevd_cython_win32_34_64.c:15515)
File "_pydevd_bundle\pydevd_cython_win32_34_64.pyx", line 254, in _pydevd_bundle.pydevd_cython_win32_34_64.PyDBFrame.do_wait_suspend (_pydevd_bundle/pydevd_cython_win32_34_64.c:5631)
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 764, in do_wait_suspend
self._activate_mpl_if_needed()
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 416, in _activate_mpl_if_needed
activate_function()
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydevd.py", line 407, in <lambda>
self.mpl_modules_for_patching = {"matplotlib": lambda: activate_matplotlib(do_enable_gui),
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydev_ipython\matplotlibtools.py", line 93, in activate_matplotlib
is_interactive = is_interactive_backend(backend)
File "D:\Programs\Eclipse Oxygen\plugins\org.python.pydev_6.2.0.201711281614\pysrc\pydev_ipython\matplotlibtools.py", line 56, in is_interactive_backend
from matplotlib.rcsetup import interactive_bk, non_interactive_bk # #UnresolvedImport
ImportError: cannot import name 'interactive_bk'
Why is this happening? (I am using python 3.4, eclipse oxygen 4.7 and PyDev 6.2.0.201711281614)
Apparently the problem is because pydev is expecting matplotlib to have some modules which aren't available in your installation... so, the import:
from matplotlib.rcsetup import interactive_bk, non_interactive_bk # #UnresolvedImport
is failing (and that's expected in PyDev if you have matplotlib installed).
Not sure why... I need to investigate whether you have a broken matplotlib or if matplotlib actually changed (in which case the pydev debugger would need to be fixed).
Can you add details on the matplotlib version you have?
Setting up the testing framework and I can't seem to get past this error:
Traceback (most recent call last):
File "/usr/local/bin/nosetests", line 8, in <module>
load_entry_point('nose==1.1.2', 'console_scripts', 'nosetests')()
File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/core.py", line 118, in __init__
**extra_args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/main.py", line 94, in __init__
self.parseArgs(argv)
File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/core.py", line 135, in parseArgs
self.config.configure(argv, doc=self.usage())
File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/config.py", line 338, in configure
self.plugins.configure(options, self)
File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/plugins/manager.py", line 271, in configure
cfg(options, config)
File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/plugins/manager.py", line 94, in __call__
return self.call(*arg, **kw)
File "/Library/Python/2.7/site-packages/nose-1.1.2-py2.7.egg/nose/plugins/manager.py", line 162, in simple
result = meth(*arg, **kw)
File "build/bdist.macosx-10.7-intel/egg/nosegae.py", line 80, in configure
File "/usr/local/bin/dev_appserver.py", line 76, in <module>
DIR_PATH = get_dir_path(os.path.join('lib', 'ipaddr'))
File "/usr/local/bin/dev_appserver.py", line 66, in get_dir_path
'file and %s.' % sibling)
ValueError: Could not determine directory that contains both, this file and lib/ipaddr.
It's a correct error coming from dev_appserver.py... there is no lib/ipaddr in the /usr/local/bin directory.
Why is nosetests triggering the raising of this error? Why does dev_appengine try to look for lib/ipaddr in the first place?