Why the permutation functions in pytest error may occur (win, pycharm)? - windows

i have Win7-32bit, PyCharm 2016.1.
Python 2.7.10, pytest-3.0.3, py-1.4.31, pluggy-0.4.0
I start pytest in PyCharm
tests.py .Exception in thread MyName:
Traceback (most recent call last):
File "C:\Python27\lib\threading.py", line 810, in __bootstrap_inner
self.run()
File "C:\Python27\lib\threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "C:\Users\user\PycharmProjects\test-py.test-on-linux-and-windows\background_worker.py", line 23, in task_manager
func(*args, **kwargs)
TypeError: t1() takes exactly 1 argument (0 given)
When i permutation test__is_returned_a_thread and test__thread_works_in_background - no errors.
Source code https://github.com/patsevanton/test-py.test-on-linux-and-windows

Related

unable to create executable using Py2exe, throwing error as mentioned below

Hi I'm trying to make an executable using py2exe, I checked my script but cannot find the actual issue why below error is keep getting pop-up during building of exe
Building 'dist\py.exe'.
Traceback (most recent call last):
File "C:\Users\User\PycharmProjects\Test\pyexe\setup.py", line 15, in <module>
freeze(
File "C:\Python39\lib\site-packages\py2exe\__init__.py", line 176, in freeze
builder.build()
File "C:\Python39\lib\site-packages\py2exe\runtime.py", line 254, in build
self.build_archive(exe_path)
File "C:\Python39\lib\site-packages\py2exe\runtime.py", line 479, in build_archive
base = dist_path.rsplit('\\', 1)[0]
AttributeError: 'NoneType' object has no attribute 'rsplit'
Below is my setup.py script
from py2exe import freeze
from py_version import VERSION, DESCRIPTION # This is my own script
freeze(
console=[{"script": "py.py"}],
options={
"py2exe": {
"dist_dir": "dist",
"bundle_files": 1, # bundle as much as possible
"compressed": True,
}},
version_info={"version":VERSION,
"description":DESCRIPTION,
"company_name":"Priyanshu Kumar",
"copyright":"Opensource, credit goes to David Manthey",
"product_name":"Stand-Alone Python3 Interpreter",
"product_version":VERSION},
zipfile=None)
UPDATE:
I was searching on google for help and found that it should be <<<zipfile="None">>> instead of <<<zipfile=None>>>.
I changed it in my code but now got new error
Traceback (most recent call last):
File "C:\Users\User\PycharmProjects\Test\pyexe\setup.py", line 29, in <module>
options={
File "C:\Python39\lib\site-packages\py2exe\__init__.py", line 176, in freeze
builder.build()
File "C:\Python39\lib\site-packages\py2exe\runtime.py", line 273, in build
self.build_archive(libpath, delete_existing_resources=True)
File "C:\Python39\lib\site-packages\py2exe\runtime.py", line 397, in build_archive
resource.add(type=os.path.basename(pydll), name=1, value=pydll_bytes)
File "C:\Python39\lib\site-packages\py2exe\resources.py", line 49, in add
raise WindowsError(details) from None
OSError: [WinError 87] The parameter is incorrect.
Press any key to continue . . .

how to read from h5py in multiprocessing without errors

I have code like:
def get_df(path, key):
with h5py.File(path) as hdf:
df = pd.DataFrame(np.array(hdf[key]))
return df
def f(key):
df = get_df(path, key)
...transform df...
return df
with multiprocessing.Pool(n_cpus) as pool:
rvals = pool.map(f, keys)
And I'm getting this error many times:
terminate called after throwing an instance of 'std::system_error'
what(): Resource temporarily unavailable
and one copy of this error:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/home/lenail/.conda/envs/py38/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/home/lenail/.conda/envs/py38/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/home/lenail/.conda/envs/py38/lib/python3.8/multiprocessing/pool.py", line 513, in _handle_workers
cls._maintain_pool(ctx, Process, processes, pool, inqueue,
File "/home/lenail/.conda/envs/py38/lib/python3.8/multiprocessing/pool.py", line 337, in _maintain_pool
Pool._repopulate_pool_static(ctx, Process, processes, pool,
File "/home/lenail/.conda/envs/py38/lib/python3.8/multiprocessing/pool.py", line 326, in _repopulate_pool_static
w.start()
File "/home/lenail/.conda/envs/py38/lib/python3.8/multiprocessing/process.py", line 121, in start
self._popen = self._Popen(self)
File "/home/lenail/.conda/envs/py38/lib/python3.8/multiprocessing/context.py", line 277, in _Popen
return Popen(process_obj)
File "/home/lenail/.conda/envs/py38/lib/python3.8/multiprocessing/popen_fork.py", line 19, in __init__
self._launch(process_obj)
File "/home/lenail/.conda/envs/py38/lib/python3.8/multiprocessing/popen_fork.py", line 70, in _launch
self.pid = os.fork()
BlockingIOError: [Errno 11] Resource temporarily unavailable
any ideas why this might be or how to fix it? I had read that h5py supports multiprocessing.
Python 3.8.13 | packaged by conda-forge
>>> h5py.__version__
'3.6.0'

pip install fails when installing mlflow

I'm working on a Window 10 machine and trying to pip install mlflow but I'm getting the following error message.
Traceback (most recent call last):
File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\pip\_vendor\urllib3\response.py", line 360, in _error_catcher
yield
File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\site-packages\pip\_vendor\urllib3\response.py", line 442, in read
data = self._fp.read(amt)
File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\http\client.py", line 447, in read
n = self.readinto(b)
File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\http\client.py", line 491, in readinto
n = self.fp.readinto(b)
File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\ssl.py", line 1052, in recv_into
return self.read(nbytes, buffer)
File "C:\Users\username\AppData\Local\Continuum\anaconda3\lib\ssl.py", line 911, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
....
During handling of the above exception, another exception occurred:
What's this issue?
This seems due to some bad network setup issues - as you can observe from the fact that you have a socket timeout on what appears to be a pip install.

conda Solving environment: failed

Any conda command returns this message
also tried reinstalling anaconda. Any help is appreciated.
Any conda command generates the same output.
$ conda upgrade conda
Solving environment: failed
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
Traceback (most recent call last):
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 280, in recv_into
return self.connection.recv_into(*args, **kwargs)
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1715, in recv_into
self._raise_ssl_error(self._ssl, result)
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1521, in _raise_ssl_error
raise WantReadError()
OpenSSL.SSL.WantReadError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 280, in recv_into
return self.connection.recv_into(*args, **kwargs)
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1715, in recv_into
self._raise_ssl_error(self._ssl, result)
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/OpenSSL/SSL.py", line 1538, in _raise_ssl_error
raise SysCallError(errno, errorcode.get(errno))
OpenSSL.SSL.SysCallError: (54, 'ECONNRESET')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/urllib3/response.py", line 302, in _error_catcher
yield
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/urllib3/response.py", line 601, in read_chunked
chunk = self._handle_chunk(amt)
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/urllib3/response.py", line 557, in _handle_chunk
value = self._fp._safe_read(amt)
File "/Users/kireto/anaconda3/lib/python3.6/http/client.py", line 612, in _safe_read
chunk = self.fp.read(min(amt, MAXAMOUNT))
File "/Users/kireto/anaconda3/lib/python3.6/socket.py", line 586, in readinto
return self._sock.recv_into(b)
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 296, in recv_into
return self.recv_into(*args, **kwargs)
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 285, in recv_into
raise SocketError(str(e))
OSError: (54, 'ECONNRESET')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/requests/models.py", line 745, in generate
for chunk in self.raw.stream(chunk_size, decode_content=True):
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/urllib3/response.py", line 432, in stream
for line in self.read_chunked(amt, decode_content=decode_content):
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/urllib3/response.py", line 626, in read_chunked
self._original_response.close()
File "/Users/kireto/anaconda3/lib/python3.6/contextlib.py", line 99, in __exit__
self.gen.throw(type, value, traceback)
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/urllib3/response.py", line 320, in _error_catcher
raise ProtocolError('Connection broken: %r' % e, e)
urllib3.exceptions.ProtocolError: ('Connection broken: OSError("(54, \'ECONNRESET\')",)', OSError("(54, 'ECONNRESET')",))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 789, in __call__
return func(*args, **kwargs)
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 78, in _main
exit_code = do_call(args, p)
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/conda/cli/conda_argparse.py", line 77, in do_call
exit_code = getattr(module, func_name)(args, parser)
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/conda/cli/main_update.py", line 14, in execute
install(args, parser, 'update')
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/conda/cli/install.py", line 236, in install
force_reinstall=context.force,
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/conda/core/solve.py", line 504, in solve_for_transaction
force_remove, force_reinstall)
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/conda/core/solve.py", line 437, in solve_for_diff
final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove)
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/conda/core/solve.py", line 178, in solve_final_state
index, r = self._prepare(prepared_specs)
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/conda/core/solve.py", line 560, in _prepare
self.subdirs, prepared_specs)
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/conda/core/index.py", line 213, in get_reduced_index
new_records = query_all(spec)
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/conda/core/index.py", line 186, in query_all
return tuple(concat(future.result() for future in as_completed(futures)))
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 90, in query
self.load()
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 134, in load
_internal_state = self._load()
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 202, in _load
mod_etag_headers.get('_mod'))
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/conda/core/repodata.py", line 402, in fetch_repodata_remote_request
timeout=timeout)
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/requests/sessions.py", line 521, in get
return self.request('GET', url, **kwargs)
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/requests/sessions.py", line 658, in send
r.content
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/requests/models.py", line 823, in content
self._content = bytes().join(self.iter_content(CONTENT_CHUNK_SIZE)) or bytes()
File "/Users/kireto/anaconda3/lib/python3.6/site-packages/requests/models.py", line 748, in generate
raise ChunkedEncodingError(e)
requests.exceptions.ChunkedEncodingError: ('Connection broken: OSError("(54, \'ECONNRESET\')",)', OSError("(54, 'ECONNRESET')",))
`$ /Users/kireto/anaconda3/bin/conda upgrade conda`
environment variables:
CIO_TEST=<not set>
CONDA_ROOT=/Users/kireto/anaconda3
PATH=/Users/kireto/anaconda3/bin:/Users/kireto/anaconda3/bin:/Library/Frame
works/Python.framework/Versions/3.7/bin:/usr/local/bin:/usr/bin:/bin:/
usr/sbin:/sbin
REQUESTS_CA_BUNDLE=<not set>
SSL_CERT_FILE=<not set>
active environment : None
user config file : /Users/kireto/.condarc
populated config files : /Users/kireto/.condarc
conda version : 4.4.10
conda-build version : 3.4.1
python version : 3.6.4.final.0
base environment : /Users/kireto/anaconda3 (writable)
channel URLs : https://repo.continuum.io/pkgs/main/osx-64
https://repo.continuum.io/pkgs/main/noarch
https://repo.continuum.io/pkgs/free/osx-64
https://repo.continuum.io/pkgs/free/noarch
https://repo.continuum.io/pkgs/r/osx-64
https://repo.continuum.io/pkgs/r/noarch
https://repo.continuum.io/pkgs/pro/osx-64
https://repo.continuum.io/pkgs/pro/noarch
https://conda.anaconda.org/conda-forge/osx-64
https://conda.anaconda.org/conda-forge/noarch
https://conda.anaconda.org/bioconda/osx-64
https://conda.anaconda.org/bioconda/noarch
package cache : /Users/kireto/anaconda3/pkgs
/Users/kireto/.conda/pkgs
envs directories : /Users/kireto/anaconda3/envs
/Users/kireto/.conda/envs
platform : osx-64
user-agent : conda/4.4.10 requests/2.18.4 CPython/3.6.4 Darwin/17.7.0 OSX/10.13.6
UID:GID : 503:20
netrc file : None
offline mode : False
An unexpected error has occurred. Conda has prepared the above report.
Upload did not complete
I tried to look at my .condarc file and even removed it but it doesn't change the outcome. Do you know what I can do to go back to a working conda?
conda version : 4.4.10
conda-build version : 3.4.1

RQT error with pyside

I am trying to use rqt_graph in ROS kinetic and I am getting the following error. I am not sure what is causing it and have no idea how to fix it.
It seems to be a problem with an undefined symbole but not sure how this would happen.
rosrun rqt_graph rqt_graph
Traceback (most recent call last):
File "/opt/ros/kinetic/lib/rqt_graph/rqt_graph", line 8, in <module>
sys.exit(main.main(sys.argv, standalone='rqt_graph.ros_graph.RosGraph'))
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rqt_gui/main.py", line 59, in main
return super(Main, self).main(argv, standalone=standalone, plugin_argument_provider=plugin_argument_provider, plugin_manager_settings_prefix=str(hash(os.environ['ROS_PACKAGE_PATH'])))
File "/opt/ros/kinetic/lib/python2.7/dist-packages/qt_gui/main.py", line 340, in main
from python_qt_binding import QT_BINDING
File "/opt/ros/kinetic/lib/python2.7/dist-packages/python_qt_binding/__init__.py", line 55, in <module>
from .binding_helper import loadUi, QT_BINDING, QT_BINDING_MODULES, QT_BINDING_VERSION # #UnusedImport
File "/opt/ros/kinetic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 252, in <module>
getattr(sys, 'SELECT_QT_BINDING_ORDER', None),
File "/opt/ros/kinetic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 98, in _select_qt_binding
raise ImportError("Could not find Qt binding (looked for: %s):\n%s" % (', '.join(["'%s'" % b for b in binding_order]), '\n'.join(error_msgs)))
ImportError: Could not find Qt binding (looked for: 'pyqt', 'pyside'):
ImportError for 'pyqt': /usr/lib/python2.7/dist-packages/PyQt5/QtCore.x86_64-linux-gnu.so: undefined symbol: _ZTI13QFileSelector
Traceback (most recent call last):
File "/opt/ros/kinetic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 89, in _select_qt_binding
QT_BINDING_VERSION = binding_loader(required_modules, optional_modules)
File "/opt/ros/kinetic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 131, in _load_pyqt
_named_import('PyQt5.%s' % module_name)
File "/opt/ros/kinetic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 111, in _named_import
module = builtins.__import__(name)
ImportError: /usr/lib/python2.7/dist-packages/PyQt5/QtCore.x86_64-linux-gnu.so: undefined symbol: _ZTI13QFileSelector
ImportError for 'pyside': /usr/lib/x86_64-linux-gnu/libQt5Network.so.5: undefined symbol: _ZN16QLoggingCategoryD1Ev
Traceback (most recent call last):
File "/opt/ros/kinetic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 89, in _select_qt_binding
QT_BINDING_VERSION = binding_loader(required_modules, optional_modules)
File "/opt/ros/kinetic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 163, in _load_pyside
_named_import('PySide2.%s' % module_name)
File "/opt/ros/kinetic/lib/python2.7/dist-packages/python_qt_binding/binding_helper.py", line 111, in _named_import
module = builtins.__import__(name)
ImportError: /usr/lib/x86_64-linux-gnu/libQt5Network.so.5: undefined symbol: _ZN16QLoggingCategoryD1Ev
code here
From What I can See In The Log Your pyqt and main Qt5 libs are missing And It's Not ROS Based Error
I Suggest You Install Or Reinstall Those Libs and Make Sure That Python Can Find Them

Resources