Why does Dash throw a TypeError when debugging through PyCharm? [closed] - python

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
When I try to run a Dash app from PyCharm in debug mode I keep getting the below TypeError. What can I do to fix this so that I can break on breakpoints in PyCharm?
I'm using: Dash 2.0.0, Python 3.9.6, PyCharm Community Edition 2021.1.3, Windows 10.
Connected to pydev debugger (build 212.4746.96)
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2021.1.3\plugins\python-ce\helpers\pydev\pydevd.py", line 1483, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2021.1.3\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:/redacted/dashboard/dashboard.py", line 170, in <module>
_app = dash.Dash(__name__, external_stylesheets=[dbc.themes.DARKLY])
File "C:\redacted\.venv\lib\site-packages\dash\dash.py", line 304, in __init__
self.server = flask.Flask(name) if server else None
File "C:\redacted\.venv\lib\site-packages\flask\app.py", line 406, in __init__
instance_path = self.auto_find_instance_path()
File "C:\redacted\.venv\lib\site-packages\flask\app.py", line 638, in auto_find_instance_path
prefix, package_path = find_package(self.import_name)
File "C:\redacted\.venv\lib\site-packages\flask\scaffold.py", line 850, in find_package
package_path = _find_package_path(root_mod_name)
File "C:\redacted\.venv\lib\site-packages\flask\scaffold.py", line 801, in _find_package_path
return os.path.dirname(next(iter(spec.submodule_search_locations)))
TypeError: 'NoneType' object is not iterable
python-BaseException
Process finished with exit code 1
Here's how I've setup my PyCharm run configuration:

Likely a bug in PyCharm. Solved by upgrading PyCharm to 2021.2.3.

Related

How can I get PySoundfile to run on Google Cloud Platform flexible environment? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I have a simple application that I'd like to deploy to a GAE standard or flexible environment, and it requires the generation of simple audio files.
I have code that runs well locally (on the dev server) using PySoundfile, but I run into errors with the underlying libsndfile when the application is deployed.
Traceback (most recent call last):
File "/env/local/lib/python2.7/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker
worker.init_process()
File "/env/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 126, in init_process
self.load_wsgi()
File "/env/local/lib/python2.7/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi
self.wsgi = self.app.wsgi()
File "/env/local/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/env/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
return self.load_wsgiapp()
File "/env/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
return util.import_app(self.app_uri)
File "/env/local/lib/python2.7/site-packages/gunicorn/util.py", line 352, in import_app
__import__(module)
File "/home/vmagent/app/main.py", line 3, in <module>
import tonegen
File "/home/vmagent/app/tonegen.py", line 4, in <module>
import soundfile as sf
File "/env/local/lib/python2.7/site-packages/soundfile.py", line 267, in <module>
_snd = _ffi.dlopen('sndfile')
File "/env/local/lib/python2.7/site-packages/cffi/api.py", line 141, in dlopen
lib, function_cache = _make_ffi_library(self, name, flags)
File "/env/local/lib/python2.7/site-packages/cffi/api.py", line 802, in _make_ffi_library
backendlib = _load_backend_lib(backend, libname, flags)
File "/env/local/lib/python2.7/site-packages/cffi/api.py", line 797, in _load_backend_lib
raise OSError(msg)
OSError: ctypes.util.find_library() did not manage to locate a library called 'sndfile'
I've also tried wave unsuccessfully.
In the flexible environment you could try to build and use a custom runtime in which you can add non-python dependencies, like OS libraries (libsndfile in your case and whatever else you may need).
Basically the same answer as in How oracle jdk can be configured in Google App Engine Flexible environment.

Django Error on Travis: RuntimeError: populate() isn't reentrant [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I am maintaining a project, with Travis CI implemented, and from one day. All my builds start failing without me touching anything or any dependence update ...
I guess that Travis changed something, I tried to investigate, but honestly I have no clue.
If I run a previous build which perfectly worked, now it fails with this everytime I call python manage.py ##whatever##
$ python manage.py collectstatic --noinput
Traceback (most recent call last):
File "manage.py", line 35, in <module>
execute_from_command_line(sys.argv)
File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/django/core/management/__init__.py", line 357, in execute
django.setup()
File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/django/apps/registry.py", line 81, in populate
raise RuntimeError("populate() isn't reentrant")
RuntimeError: populate() isn't reentrant
By the way, I obtain the exact same error with Python 3.6 and 3.5.
$ python manage.py collectstatic --noinput
Traceback (most recent call last):
File "manage.py", line 35, in <module>
execute_from_command_line(sys.argv)
File "/home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/django/core/management/__init__.py", line 357, in execute
django.setup()
File "/home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/django/__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/travis/virtualenv/python3.5.6/lib/python3.5/site-packages/django/apps/registry.py", line 81, in populate
raise RuntimeError("populate() isn't reentrant")
RuntimeError: populate() isn't reentrant
And naturally, this issue is impossible to reproduce on my own machine ... It's running just fine locally.
Additional Information:
If I take a former build which already passed without any issue:
Link: Travis Build #1336
And I decide to relaunch the build, as you can see the builds are now failing for an obscure reason...
Any idea how to solve this issue ?

Python trying to run behave get errors

I'm trying to use behave to run selenium tests but I'm stuck at start of that idea.
I've setup python, selenium and behave as it should be. I'm running python scripts with selenium without an problem. My problems starts when I try to run them with behave. My python is 3.5.2, selenium is 2.53.2 and behave is 1.2.5.
When I try to run any feature file I get errors bellow. It doesn't matter if I try to run it with PyCharm IDE or directly from command prompt. Does any one have a clue what is wrong or what I do wrong?
Errors:
Traceback (most recent call last):
File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pycharm\behave_runner.py", line 269, in <module>
_BehaveRunner(my_config, base_dir).run()
File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pycharm\_bdd_utils.py", line 92, in run
number_of_tests = self._get_number_of_tests()
File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pycharm\_bdd_utils.py", line 206, in _get_number_of_tests
for feature in self._get_features_to_run():
File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pycharm\behave_runner.py", line 209, in _get_features_to_run
self.__real_runner.run()
File "C:\Python35\lib\site-packages\behave-1.2.5-py3.5.egg\behave\runner.py", line 672, in run
File "C:\Python35\lib\site-packages\behave-1.2.5-py3.5.egg\behave\runner.py", line 677, in run_with_paths
File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pycharm\behave_runner.py", line 92, in load_hooks
super(_RunnerWrapper, self).load_hooks(filename)
File "C:\Python35\lib\site-packages\behave-1.2.5-py3.5.egg\behave\runner.py", line 631, in load_hooks
File "C:\Python35\lib\site-packages\behave-1.2.5-py3.5.egg\behave\runner.py", line 303, in exec_file
File "features\environment.py", line 11
print("Before scenario\n")
^
IndentationError: unindent does not match any outer indentation level
Process finished with exit code 1
Your traceback returns: 'IndentationError: unindent does not match any outer indentation level'.
This is usually an indicator that your tab/spaces of your indentation level is incorrect.
Could you try to reformat the file tabbing to 4 spaces?
As khelwood noted, the file you should take a look at is 'features\environment.py' around line number 11.
This usually should solve this problem.

Ghost.py - what does this stack trace mean? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
How do I go about debugging this stack trace?
Traceback (most recent call last):
File "<string>", line 73, in execInThread
File "C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\netref.py", line 196, in __call__
File "C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\netref.py", line 71, in syncreq
File "C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\protocol.py", line 431, in sync_request
File "C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\protocol.py", line 379, in serve
File "C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\protocol.py", line 337, in _recv
File "C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\channel.py", line 50, in recv
File "C:\Program Files (x86)\PyScripter\Lib\rpyc.zip\rpyc\core\stream.py", line 166, in read
EOFError: [Errno 10054] An existing connection was forcibly closed by the remote host
The stack trace does not refer to a line in my code, which is too long to reproduce here. However, the key component other than the standard python library is Ghost.py.
Thanks!
This means the server closed the connection unexpectedly, usually because it crashed for some reason. In this case, it looks like the client is pyscripter and the server is a subprocess running your app, and it sounds like the subprocess crashed so hard that it did not gracefully close the connection or send back a meaningful traceback. So, either there is a bug in pyscripter or a bug in your code. My advice is to run your app without the IDE and see if you can reproduce the issue and get a meaningful traceback.

Audio/Video streaming fails using SimpleHTTPServer [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
I share files in a folder to other devices by invoking a server using python -m SimpleHTTPServer.
I just tried to stream videos/audio (standard mp4 & mp3, both under 20MB) to another computer using this & it WORKS (but by throwing the errors (listed down) in the terminal).
Somehow, the video/audio fails (except very small mp3 files) to play with Safari in iPhone/iPad. It is definitely not related to the media files, as I streamed them successfully using Apache in iPhone.
Any idea why it happens?
Exception happened during processing of request from ('192.168.1.2', 51775)
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 284, in _handle_request_noblock
self.process_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 310, in process_request
self.finish_request(request, client_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 323, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 641, in __init__
self.finish()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/SocketServer.py", line 694, in finish
self.wfile.flush()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
As sugested either use python alternatives, What is a faster alternative to Python's http.server (or SimpleHTTPServer)? or use full blown web serwer altogether. Quick google suggests that Mac supports both Nignx and Apache2.

Categories