I'm not sure if Eventlet works on OS X because epolls doesn't support OS X.
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inn
er
self.run()
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "scraper.py", line 44, in thread_worker
with eventlet.Timeout(60, False):
File "/usr/local/lib/python3.7/site-packages/eventlet/timeout.py", line 55, in __init__
self.start()
File "/usr/local/lib/python3.7/site-packages/eventlet/timeout.py", line 66, in start
self.timer = get_hub().schedule_call_global(
File "/usr/local/lib/python3.7/site-packages/eventlet/hubs/__init__.py", line 117, in get_hub
use_hub()
File "/usr/local/lib/python3.7/site-packages/eventlet/hubs/__init__.py", line 71, in use_hub
mod = get_default_hub()
File "/usr/local/lib/python3.7/site-packages/eventlet/hubs/__init__.py", line 40, in get_default_hub
return eventlet.hubs.epolls
AttributeError: module 'eventlet.hubs' has no attribute 'epolls'
Eventlet is not platform-specific but its hubs can be. The epolls hub is only for Linux and it is Eventlet's default but you can change it. Check Eventlet's hubs docs to pick the right one for your situation & call eventlet.hubs.use_hub before performing any IO.
Example, using the platform-independent selects hub:
import eventlet
eventlet.hubs.use_hub("selects")
Related
I want to use pyocd-gdbserver on my M1 Mac mini, but it won't load.
I'm running Python 3.9 (arm64), and I get this long traceback (below) because some .dylib only has i386 and x86_64 architectures, and what's needed is arm64e (is that different from arm64?).
I don't know what .dylib it is, because pyocd makes an anonymised private copy. I've downloaded the arm64 version of Segger's JLink software, and libusb is also arm64.
I've been running the same board (BBC micro:bit v1.3B) on an Intel Mac, and pyocd worked fine without having installed Segger's JLink firmware on it; but just in case I installed Segger's firmware - no difference.
Here's the log ... (I've folded the lines at the end)
$ pyocd-gdbserver
Traceback (most recent call last):
File "/Users/simon/Library/Python/3.9/bin/pyocd-gdbserver", line 5, in <module>
from pyocd.tools.gdb_server import main
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pyocd/__init__.py", line 21, in <module>
from . import gdbserver
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pyocd/gdbserver/__init__.py", line 17, in <module>
from .gdbserver import GDBServer
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pyocd/gdbserver/gdbserver.py", line 49, in <module>
from ..commands.commander import ToolExitException
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pyocd/commands/commander.py", line 25, in <module>
from ..core.helpers import ConnectHelper
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pyocd/core/helpers.py", line 26, in <module>
from ..probe.aggregator import DebugProbeAggregator
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pyocd/probe/aggregator.py", line 83, in <module>
load_plugin_classes_of_type('pyocd.probe', PROBE_CLASSES, DebugProbe)
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pyocd/core/plugin.py", line 104, in load_plugin_classes_of_type
if plugin.should_load():
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pyocd/probe/jlink_probe.py", line 377, in should_load
return JLinkProbe._get_jlink() is not None
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pyocd/probe/jlink_probe.py", line 50, in _get_jlink
return pylink.JLink(
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pylink/jlink.py", line 292, in __init__
lib = library.Library()
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pylink/library.py", line 261, in __init__
self.load_default()
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pylink/library.py", line 299, in load_default
return self.load(path)
File "/Users/simon/Library/Python/3.9/lib/python/site-packages/pylink/library.py", line 353, in load
self._lib = ctypes.cdll.LoadLibrary(tf.name)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 452, in LoadLibrary
return self._dlltype(name)
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/var/folders/ch/k_zwspdx3qsfbt1_x21zld6m0000gn/T/tmp5g6hpqrt.dylib, 0x0006): tried:
'/var/folders/ch/k_zwspdx3qsfbt1_x21zld6m0000gn/T/tmp5g6hpqrt.dylib'
(fat file, but missing compatible architecture (have (i386,x86_64), need (arm64e))),
'/private/var/folders/ch/k_zwspdx3qsfbt1_x21zld6m0000gn/T/tmp5g6hpqrt.dylib'
(fat file, but missing compatible architecture (have (i386,x86_64), need (arm64e)))
when I ran the application, it raised error as follows.
My python version is 3.8.10 and pyinstaller version is 4.4.
How to deal with it?
Traceback (most recent call last):
File "run.py", line 360, in huaban.run.MainWorkPanel.start_download
File "run.py", line 594, in huaban.run.MainWorkPanel.real_run
File "scrapy\crawler.py", line 280, in __init__
File "scrapy\crawler.py", line 152, in __init__
File "scrapy\crawler.py", line 146, in _get_spider_loader
File "scrapy\spiderloader.py", line 67, in from_settings
File "scrapy\spiderloader.py", line 24, in __init__
File "scrapy\spiderloader.py", line 51, in _load_all_spiders
File "scrapy\utils\misc.py", line 83, in walk_modules
File "C:\soft\VirtualenvFiles\huaban\Lib\site-packages\PyInstaller\hooks\rthooks\pyi_rth_pkgutil.py", line 71, in _pyi_pkgutil_iter_modules
assert pkg_path.startswith(SYS_PREFIX)
TypeError: startswith first arg must be str or a tuple of str, not PureWindowsPath
Fixed in PyInstaller 4.5.
See here.
I have just installed pyglet on my machine. But I can't seem to create a window
here's what I tried
import pyglet
window = pyglet.window.Window()
pyglet.app.run()
and it gives me this error when I run
Traceback (most recent call last):
File "c:/Users/Public/Documents/vscode/python/Games/Pyglet/main.py", line 3, in <module>
window = pyglet.window.Window()
File "C:\Users\DELL\AppData\Roaming\Python\Python38\site-packages\pyglet\window\win32\__init__.py", line 132, in __init__
super(Win32Window, self).__init__(*args, **kwargs)
File "C:\Users\DELL\AppData\Roaming\Python\Python38\site-packages\pyglet\window\__init__.py", line 648, in __init__
self._create()
File "C:\Users\DELL\AppData\Roaming\Python\Python38\site-packages\pyglet\window\win32\__init__.py", line 274, in _create
self.context.attach(self.canvas)
File "C:\Users\DELL\AppData\Roaming\Python\Python38\site-packages\pyglet\gl\win32.py", line 238, in attach
raise gl.ContextException('Unable to share contexts.')
pyglet.gl.ContextException: Unable to share contexts.
I'm trying to integrate two frameworks, and I'm installing requirements for both of frameworks, but it seems like the library 'Crypto' used in both frameworks and have different versions of use, so if I install requirements for one of the frameworks, it returns me the first error:
Traceback (most recent call last):
File "dapp_bdb.py", line 134, in <module>
main()
File "dapp_bdb.py", line 112, in main
blockchain = LevelDBBlockchain(settings.chain_leveldb_path)
File "/home/ubuntu/.local/lib/python3.6/site-packages/neo/Implementations/Blockchains/LevelDB/LevelDBBlockchain.py", line 190, in __init__
self.Persist(Blockchain.GenesisBlock())
File "/home/ubuntu/.local/lib/python3.6/site-packages/neo/Implementations/Blockchains/LevelDB/LevelDBBlockchain.py", line 691, in Persist
account = accounts.GetAndChange(output.AddressBytes, AccountState(output.ScriptHash))
File "/home/ubuntu/.local/lib/python3.6/site-packages/neo/Core/TX/Transaction.py", line 121, in AddressBytes
return bytes(self.Address, encoding='utf-8')
File "/home/ubuntu/.local/lib/python3.6/site-packages/neo/Core/TX/Transaction.py", line 111, in Address
return Crypto.ToAddress(self.ScriptHash)
File "/home/ubuntu/.local/lib/python3.6/site-packages/neocore/Cryptography/Crypto.py", line 103, in ToAddress
return scripthash_to_address(script_hash.Data)
File "/home/ubuntu/.local/lib/python3.6/site-packages/neocore/Cryptography/Helper.py", line 78, in scripthash_to_address
return base58.b58encode(bytes(outb)).decode("utf-8")
AttributeError: 'str' object has no attribute 'decode'
and with the second requrirements of the framework, it returns me other error:
exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "dapp_bdb.py", line 95, in custom_background_code
put_bdb("Hello world")
File "dapp_bdb.py", line 68, in put_bdb
fulfilled_creation_tx = bdb.transactions.fulfill(prepared_creation_tx, private_keys=private_key)
File "/home/ubuntu/.local/lib/python3.6/site-packages/bigchaindb_driver/driver.py", line 270, in fulfill
return fulfill_transaction(transaction, private_keys=private_keys)
File "/home/ubuntu/.local/lib/python3.6/site-packages/bigchaindb_driver/offchain.py", line 346, in fulfill_transaction
signed_transaction = transaction_obj.sign(private_keys)
File "/home/ubuntu/.local/lib/python3.6/site-packages/bigchaindb_driver/common/transaction.py", line 823, in sign
PrivateKey(private_key) for private_key in private_keys}
File "/home/ubuntu/.local/lib/python3.6/site-packages/bigchaindb_driver/common/transaction.py", line 823, in <dictcomp>
PrivateKey(private_key) for private_key in private_keys}
File "/home/ubuntu/.local/lib/python3.6/site-packages/bigchaindb_driver/common/transaction.py", line 817, in gen_public_key
public_key = private_key.get_verifying_key().encode()
File "/home/ubuntu/.local/lib/python3.6/site- packages/cryptoconditions/crypto.py", line 62, in get_verifying_key
return Ed25519VerifyingKey(self.verify_key.encode(encoder=Base58Encoder))
File "/home/ubuntu/.local/lib/python3.6/site-packages/nacl/encoding.py", line 90, in encode
return encoder.encode(bytes(self))
File "/home/ubuntu/.local/lib/python3.6/site-packages/cryptoconditions/crypto.py", line 15, in encode
return base58.b58encode(data).encode()
AttributeError: 'bytes' object has no attribute 'encode'
Is there any ideas how I can avoid it?
Looks like cryptoconditions library is doing it wrong.
You should file a bug asking to update required version of base58 and review all the calls to it. Usual behavior for Python3 is to return bytes on some_encoder_library.encode() and str on some_encoder_library.decode(). New versions of base58 module follow this rule although base58-encoded objects never contain any special symbols of course. cryptoconditions are still using previous version where b58encode were returning str.
Meanwhile you can make local modifications to the installed library or for it and install your fork instead.
It is likely that everything will work OK with encode() call removed from this line.
I have a Django app running on a linux machine (Debian). For the past little while the app has run perfectly. Recently I needed to reboot the machine after celery tasks started to hang and purging the tasks didn't have the desired effect. When I now attempt to start celery using
sudo celery -A myapp.tasks worker -Ofair
I am presented with the following traceback
Traceback (most recent call last):
File "/usr/local/bin/celery", line 9, in <module>
load_entry_point('celery==3.1.11', 'console_scripts', 'celery')()
File "/usr/local/lib/python2.7/dist-packages/celery/__main__.py", line 30, in main
main()
File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 81, in main
cmd.execute_from_commandline(argv)
File "/usr/local/lib/python2.7/dist-packages/celery/bin/celery.py", line 769, in execute_from_commandline
super(CeleryCommand, self).execute_from_commandline(argv)))
File "/usr/local/lib/python2.7/dist-packages/celery/bin/base.py", line 304, in execute_from_commandline
argv = self.setup_app_from_commandline(argv)
File "/usr/local/lib/python2.7/dist-packages/celery/bin/base.py", line 464, in setup_app_from_commandline
self.app = self.find_app(app)
File "/usr/local/lib/python2.7/dist-packages/celery/bin/base.py", line 484, in find_app
return find_app(app, symbol_by_name=self.symbol_by_name)
File "/usr/local/lib/python2.7/dist-packages/celery/app/utils.py", line 225, in find_app
sym = imp(app)
File "/usr/local/lib/python2.7/dist-packages/celery/utils/imports.py", line 101, in import_from_cwd
return imp(module, package=package)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/this/gce_app/myapp/tasks.py", line 8, in <module>
from django.views.decorators.csrf import csrf_exempt
File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/csrf.py", line 1, in <module>
from django.middleware.csrf import CsrfViewMiddleware, get_token
File "/usr/local/lib/python2.7/dist-packages/django/middleware/csrf.py", line 14, in <module>
from django.utils.cache import patch_vary_headers
File "/usr/local/lib/python2.7/dist-packages/django/utils/cache.py", line 26, in <module>
from django.core.cache import get_cache
File "/usr/local/lib/python2.7/dist-packages/django/core/cache/__init__.py", line 69, in <module>
if DEFAULT_CACHE_ALIAS not in settings.CACHES:
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 54, in __getattr__
self._setup(name)
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 47, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting CACHES, but settings are not configured. You must
either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing set
tings.
I have added the export to bashrc (at the end) which fixed the problem in the past, but now I am still presented with the same error:
sudo nano ~/.bashrc
export DJANGO_SETTINGS_MODULE='myproject.settings'
Is there a way to get this working again?
You're starting celery with sudo, which means you're running as the root user, not the one you set the environment variable for. Don't do that - there's absolutely no good reason to run the daemon with sudo.
(And not related to your problem, but you shouldn't be editing bashrc as sudo either.)