macOS python command line stopped working. cannot pickle '_thread._local' - python

I updated macOS recently and "/usr/local/bin/rethinkdb restore" now no longer works..
/usr/local/bin/rethinkdb restore --force /Users/rob/rdb_backup.tar.gz
Extracting archive file...
Done (0 seconds)
Importing from directory...
Traceback (most recent call last):
File "/usr/local/bin/rethinkdb-restore", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.9/site-packages/rethinkdb/_restore.py", line 339, in main
do_restore(options)
File "/usr/local/lib/python3.9/site-packages/rethinkdb/_restore.py", line 315, in do_restore
_import.import_tables(options, sources)
File "/usr/local/lib/python3.9/site-packages/rethinkdb/_import.py", line 1359, in import_tables
progress_bar.start()
File "/usr/local/Cellar/python#3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
File "/usr/local/Cellar/python#3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py", line 224, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "/usr/local/Cellar/python#3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/context.py", line 284, in _Popen
return Popen(process_obj)
File "/usr/local/Cellar/python#3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 32, in __init__
super().__init__(process_obj)
File "/usr/local/Cellar/python#3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_fork.py", line 19, in __init__
self._launch(process_obj)
File "/usr/local/Cellar/python#3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 47, in _launch
reduction.dump(process_obj, fp)
File "/usr/local/Cellar/python#3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
TypeError: cannot pickle '_thread._local' object
I've refreshed my python install via brew, but that didn't help.
I don't use python myself, so I'm not familiar with fixing issues with it.
Any help would be appreciated.
Update: after much searching I found many people with the same issue and the consensus was the python code bundled with rethinkdb was broken and no longer supported. A couple of people offered nodejs replacements for the restore functionality. I was unable to get either working, probably due to dependencies.
The solution I read about that proved successful was to downgrade to python 3.7.9

Related

PyInstaller executable with panda3d throws exception

I am having an issue with a program, which uses panda3d. It works perfectly when executed as a pythonscript, but the version, which is compiled (or rather packaged) by PyInstaller throws the exception below.
:display(warning): Unable to load libpandagl.so: No error.
Known pipe types:
(all display modules loaded.)
Traceback (most recent call last):
File "Shipsim3d_1-1.py", line 930, in <module>
File "Shipsim3d_1-1.py", line 23, in __init__
File "direct/showbase/ShowBase.py", line 339, in __init__
File "direct/showbase/ShowBase.py", line 1024, in openDefaultWindow
File "direct/showbase/ShowBase.py", line 1059, in openMainWindow
File "direct/showbase/ShowBase.py", line 769, in openWindow
File "direct/showbase/ShowBase.py", line 749, in <lambda>
File "direct/showbase/ShowBase.py", line 821, in _doOpenWindow
File "direct/showbase/ShowBase.py", line 650, in makeDefaultPipe
File "direct/directnotify/Notifier.py", line 130, in error
Exception: No graphics pipe is available!
Your Config.prc file must name at least one valid panda display
library via load-display or aux-display.
[5466] Failed to execute script 'Shipsim3d_1-1' due to unhandled exception!
The .prc file doesn't exist in the executable, but even if I copy it there manually, it still doesn't work. In my Code, I use a function called loadPrcData. Is that a Part of the problem? Or is it something else?
Thanks in advance

PyInstaller executable not working with panda3d. No graphics pipe availabe

I am having an issue with a program, which uses panda3d. It works perfectly when executed as a pythonscript, but the version, which is compiled (or rather packaged) by PyInstaller throws the exception below.
:display(warning): Unable to load libpandagl.so: No error.
Known pipe types:
(all display modules loaded.)
Traceback (most recent call last):
File "Shipsim3d_1-1.py", line 930, in <module>
File "Shipsim3d_1-1.py", line 23, in __init__
File "direct/showbase/ShowBase.py", line 339, in __init__
File "direct/showbase/ShowBase.py", line 1024, in openDefaultWindow
File "direct/showbase/ShowBase.py", line 1059, in openMainWindow
File "direct/showbase/ShowBase.py", line 769, in openWindow
File "direct/showbase/ShowBase.py", line 749, in <lambda>
File "direct/showbase/ShowBase.py", line 821, in _doOpenWindow
File "direct/showbase/ShowBase.py", line 650, in makeDefaultPipe
File "direct/directnotify/Notifier.py", line 130, in error
Exception: No graphics pipe is available!
Your Config.prc file must name at least one valid panda display
library via load-display or aux-display.
[5466] Failed to execute script 'Shipsim3d_1-1' due to unhandled exception!
Usually, there is a Config.prc file in the etc subdirectory of the panda3d site-package directory. This file is non-existent in the packaged version. But if I create this subdirectory there, and copy the files to it as well, it still doesn't work and it still throws the same exception. There is a line "loadPrcData("win-size 1080 1920")" in my main program as well. Could this be part of the problem in any way? Or is there something else i am missing?
Thanks in advance
I solved this problem by including the whole panda3d lib:
pyinstaller --add-data="path/to/panda3d;panda3d" -wF main.py

Django Error when running server locally - AttributeError: 'list' object has no attribute 'read'

Getting below error when trying to run server in VS Code for Django.
Command: python manage.py runserver
Error:
C:\DjangoServerTest\DjangoServerTest>python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 21, in <module>
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "C:\Users\subhasispanda\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line
utility.execute()
File "C:\Users\subhasispanda\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\subhasispanda\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\subhasispanda\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\commands\runserver.py", line 60, in execute
super().execute(*args, **options)
File "C:\Users\subhasispanda\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\base.py", line 369, in execute
output = self.handle(*args, **options)
File "C:\Users\subhasispanda\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\commands\runserver.py", line 95, in handle
self.run(**options)
File "C:\Users\subhasispanda\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\management\commands\runserver.py", line 102, in run
autoreload.run_with_reloader(self.inner_run, **options)
File "C:\Users\subhasispanda\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\autoreload.py", line 601, in run_with_reloader
exit_code = restart_with_reloader()
File "C:\Users\subhasispanda\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\utils\autoreload.py", line 230, in restart_with_reloader
p = subprocess.run(args, env=new_environ, close_fds=False)
File "C:\Users\subhasispanda\AppData\Local\Programs\Python\Python37-32\lib\site-packages\run\__init__.py", line 145, in __new__
process = cls.create_process(command, stdin, cwd=cwd, env=env, shell=shell)
File "C:\Users\subhasispanda\AppData\Local\Programs\Python\Python37-32\lib\site-packages\run\__init__.py", line 121, in create_process
shlex.split(command),
File "C:\Users\subhasispanda\AppData\Local\Programs\Python\Python37-32\lib\shlex.py", line 305, in split
return list(lex)
File "C:\Users\subhasispanda\AppData\Local\Programs\Python\Python37-32\lib\shlex.py", line 295, in __next__
token = self.get_token()
File "C:\Users\subhasispanda\AppData\Local\Programs\Python\Python37-32\lib\shlex.py", line 105, in get_token
raw = self.read_token()
File "C:\Users\subhasispanda\AppData\Local\Programs\Python\Python37-32\lib\shlex.py", line 136, in read_token
nextchar = self.instream.read(1)
AttributeError: 'list' object has no attribute 'read'
Can you please help here?
I too had the same issue.
What i did is that i went to control panel -> search -> advanced system settings ->environment variables -> Path
then cleared all paths
Uninstalled python, and deleted all the python related files in the "C:\Users{user_name}\AppData\Local\Programs" directory
And then downloaded the latest one and installed again.
Then added the scripts folder and the python folder directory into the PATH.
Then installed pip and then django.
Now its woking perfectly.
In short remove all the versions of python completely and then install it again. Also clear all the unwanted "paths" in the environment variables.....
I spent around 2 hours on the same issue that I was facing.
I could not understand why the error is occurring but I found the solution by simply uninstalling python and re-installing it.
In my case I had more than 1 number of python versions installed so I deleted all the 'site-packages' folder too and installed the latest version of python again and it worked.
Let me know if this works for you too.
I had the same Error AttributeError: 'list' object has no attribute 'read' in Django, I uninstalled a package called "subprocess.run" with "pip uninstall [package-name]" and that's all. You can run your project

TypeError: expected str, bytes or os.PathLike object, not NoneType _ while using pyinstaller

I wrote 3 python scripts and all of them are working fine when I run them with python3.6. Now I wanted to build executable files for each of these scripts using pyinstaller. Please Note that I cannot install pyinstaller on the computer due to the rules in my institution, so I downloaded the pyinstaller package and run the pyinstaller.py with python3.6 from the directory and it works fine.
The problem which I'm facing right now is the following:
Building the .exe works for one script without problems, but if I try to build the other 2 scripts I get the following error :
Traceback (most recent call last):
File "pyinstaller.py", line 15, in <module>
run()
File "/home/akaroui/PyInstaller-3.3.1/PyInstaller/__main__.py", line 94, in run
run_build(pyi_config, spec_file, **vars(args))
File "/home/akaroui/PyInstaller-3.3.1/PyInstaller/__main__.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/home/akaroui/PyInstaller-3.3.1/PyInstaller/building/build_main.py", line 791, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "/home/akaroui/PyInstaller-3.3.1/PyInstaller/building/build_main.py", line 737, in build
exec(text, spec_namespace)
File "<string>", line 22, in <module>
File "/home/akaroui/PyInstaller-3.3.1/PyInstaller/building/build_main.py", line 213, in __init__
self.__postinit__()
File "/home/akaroui/PyInstaller-3.3.1/PyInstaller/building/datastruct.py", line 161, in __postinit__
self.assemble()
File "/home/akaroui/PyInstaller-3.3.1/PyInstaller/building/build_main.py", line 472, in assemble
module_hook.post_graph()
File "/home/akaroui/PyInstaller-3.3.1/PyInstaller/building/imphook.py", line 414, in post_graph
self._process_hook_func()
File "/home/akaroui/PyInstaller-3.3.1/PyInstaller/building/imphook.py", line 433, in _process_hook_func
self._hook_module.hook(hook_api)
File "/home/akaroui/PyInstaller-3.3.1/PyInstaller/hooks/hook-_tkinter.py", line 245, in hook
hook_api.add_datas(_collect_tcl_tk_files(hook_api))
File "/home/akaroui/PyInstaller-3.3.1/PyInstaller/hooks/hook-_tkinter.py", line 208, in _collect_tcl_tk_files
tcl_root, tk_root = _find_tcl_tk(hook_api)
File "/home/akaroui/PyInstaller-3.3.1/PyInstaller/hooks/hook-_tkinter.py", line 159, in _find_tcl_tk
bins = selectImports(hook_api.__file__)
File "/home/akaroui/PyInstaller-3.3.1/PyInstaller/depend/bindepend.py", line 493, in selectImports
xtrapath = [os.path.dirname(pth)]
File "/usr/local/python/3.6.1/lib/python3.6/posixpath.py", line 154, in dirname
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType
Does anyone have an idea how can I fix this problem ?
Here are more information :
Using Linux - Python3.6
the Scripts where I get the problem do open files and modify their content, and also run some pdflatex-scripts. They are as I mentioned working fine when I run them with Python, the only problem is building the .exe from them.

Python unit-testing with nose + GAE plugin

Since today morning I'm having some weird problem with Python's unit-testing tool Nose + NoseGAE. I want to run unit-tests for my GAE project in terminal and it ends with this error:
Traceback (most recent call last):
File "/usr/local/bin/nosetests", line 8, in <module>
load_entry_point('nose==1.2.1', 'console_scripts', 'nosetests')()
File "/Library/Python/2.7/site-packages/nose-1.2.1-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.2.1-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.2.1-py2.7.egg/nose/config.py", line 338, in configure
self.plugins.configure(options, self)
File "/Library/Python/2.7/site-packages/nose-1.2.1-py2.7.egg/nose/plugins/manager.py", line 284, in configure
cfg(options, config)
File "/Library/Python/2.7/site-packages/nose-1.2.1-py2.7.egg/nose/plugins/manager.py", line 99, in __call__
return self.call(*arg, **kw)
File "/Library/Python/2.7/site-packages/nose-1.2.1-py2.7.egg/nose/plugins/manager.py", line 167, in simple
result = meth(*arg, **kw)
File "build/bdist.macosx-10.7-intel/egg/nosegae.py", line 84, in configure
File "/usr/local/google_appengine/google/appengine/tools/dev_appserver.py", line 61, in <module>
import simplejson
ImportError: No module named simplejson
It's weird because I'm not even using simplejson anywhere. I know it's part of Django, but I'm not using it either.
OS X 10.7.4
Python 2.7.1
Nose 1.2.1
NoseGAE 0.2.0
Do you have any idea what might be wrong?
This was probably just temporary problem in older GAE on OS X. Newer versions run without any problem.

Categories

Resources