pyglet errors for python3 - python

The pyglet module on my computer isn't working. I've tried a lot of suggestions from others and none of them have worked.
First I tried pip3 install pyglet. But when I tried to run code I got this error:
Traceback (most recent call last):
File "/Users/chervjay/Downloads/gameloop.py", line 5, in <module>
from pyglet.gl import *
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyglet/gl/__init__.py", line 236, in <module>
import pyglet.window
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyglet/window/__init__.py", line 1816, in <module>
gl._create_shadow_window()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyglet/gl/__init__.py", line 205, in _create_shadow_window
_shadow_window = Window(width=1, height=1, visible=False)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyglet/window/__init__.py", line 493, in __init__
display = get_platform().get_default_display()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyglet/window/__init__.py", line 1765, in get_default_display
return pyglet.canvas.get_display()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyglet/canvas/__init__.py", line 82, in get_display
return Display()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyglet/canvas/carbon.py", line 22, in __init__
import MacOS
ImportError: No module named 'MacOS'
Then I commented out the lines that use MacOS in carbon.py, which are only 2, and ran it again, and this time it said
Traceback (most recent call last):
File "/Users/chervjay/Downloads/gameloop.py", line 132, in <module>
app = App()
File "/Users/chervjay/Downloads/gameloop.py", line 114, in __init__
self.hud = Hud(self.win)
File "/Users/chervjay/Downloads/gameloop.py", line 97, in __init__
color=(1, 1, 1, 0.5),
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyglet/font/__init__.py", line 348, in __init__
group=self._group)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyglet/text/layout.py", line 791, in __init__
self.document = document
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyglet/text/layout.py", line 874, in _set_document
self._init_document()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyglet/text/layout.py", line 977, in _init_document
self._update()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyglet/text/layout.py", line 911, in _update
lines = self._get_lines()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyglet/text/layout.py", line 887, in _get_lines
glyphs = self._get_glyphs()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyglet/text/layout.py", line 1016, in _get_glyphs
glyphs.extend(font.get_glyphs(text[start:end]))
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyglet/font/base.py", line 378, in get_glyphs
self.glyphs[c] = glyph_renderer.render(c)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyglet/font/carbon.py", line 240, in render
text_ucs2 = str_ucs2(text)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pyglet/font/carbon.py", line 194, in str_ucs2
return create_string_buffer(text + '\0')
TypeError: can't concat bytes to str
I have tried
pip3.5 install --upgrade http://pyglet.googlecode.com/archive/tip.zip and got the same errors. I cannot find any other answers.
Please help if you know how to. Thank you.
I got the code I'm trying to run from http://tartley.com/?p=250.

Related

Miniconda: cannot launch spyder

I have always been able to launch spyder without any issues. But today I started running into the following error messages. I don't understand why is it complaining no workingdir? How do I resolve this, as I cannot even launch spyder ?
Traceback (most recent call last):
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\Scripts\spyder-script.py", line 10, in <module>
sys.exit(main())
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\app\start.py", line 253, in main
mainwindow.main(options, args)
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\app\mainwindow.py", line 1956, in main
mainwindow = create_window(MainWindow, app, splash, options, args)
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\app\utils.py", line 289, in create_window
main.setup()
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\app\mainwindow.py", line 771, in setup
PLUGIN_REGISTRY.register_plugin(self, PluginClass,
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\api\plugin_registration\registry.py", line 342, in register_plugin
instance = self._instantiate_spyder5_plugin(
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\api\plugin_registration\registry.py", line 193, in _instantiate_spyder5_plugin
plugin_instance.initialize()
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\api\plugins\new_api.py", line 669, in initialize
self.on_initialize()
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\plugins\workingdirectory\plugin.py", line 82, in on_initialize
container.set_history(
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\plugins\workingdirectory\container.py", line 323, in set_history
workdir = self._get_init_workdir()
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\plugins\workingdirectory\container.py", line 183, in _get_init_workdir
workdir = self.get_conf('startup/fixed_directory')
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\api\config\mixins.py", line 76, in get_conf
return CONF.get(section, option, default)
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\config\manager.py", line 499, in get
value = config.get(section=section, option=option, default=default)
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\config\user.py", line 980, in get
return config.get(section=section, option=option, default=default)
File "C:\Users\xxx\AppData\Local\miniconda\envs\py3_10\lib\site-packages\spyder\config\user.py", line 511, in get
raise cp.NoSectionError(section)
configparser.NoSectionError: No section: 'workingdir'

KeyError: 'SECRETS_PATH' Error: '' is not a valid port number

I am trying to run the image with permissions docker run --user 1000:1000 connectors but i got the error:
docker run --user 1000:1000 connectors
* Tip: There are .env or .flaskenv files present. Do "pip install python-dotenv" to use them.
Traceback (most recent call last):
File "/home/connectors/.local/bin/flask", line 8, in <module>
sys.exit(main())
File "/home/connectors/.local/lib/python3.10/site-packages/flask/cli.py", line 988, in main
cli.main()
File "/home/connectors/.local/lib/python3.10/site-packages/flask/cli.py", line 579, in main
return super().main(*args, **kwargs)
File "/home/connectors/.local/lib/python3.10/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/home/connectors/.local/lib/python3.10/site-packages/click/core.py", line 1653, in invoke
cmd_name, cmd, args = self.resolve_command(ctx, args)
File "/home/connectors/.local/lib/python3.10/site-packages/click/core.py", line 1700, in resolve_command
cmd = self.get_command(ctx, cmd_name)
File "/home/connectors/.local/lib/python3.10/site-packages/flask/cli.py", line 535, in get_command
return info.load_app().cli.get_command(ctx, name)
File "/home/connectors/.local/lib/python3.10/site-packages/flask/cli.py", line 389, in load_app
app = locate_app(import_name, name)
File "/home/connectors/.local/lib/python3.10/site-packages/flask/cli.py", line 234, in locate_app
__import__(module_name)
File "/app/api/app.py", line 15, in <module>
from api.fields import fields_blueprint
File "/app/api/fields.py", line 13, in <module>
from api.oauth import validate_auth_if_provided
File "/app/api/oauth.py", line 13, in <module>
from base import api_helpers, env
File "/app/base/api_helpers.py", line 11, in <module>
from base import env
File "/app/base/env.py", line 32, in <module>
SECRETS_PATH: str = os.environ["SECRETS_PATH"]
File "/usr/local/lib/python3.10/os.py", line 679, in __getitem__
raise KeyError(key) from None
KeyError: 'SECRETS_PATH'
Error: '' is not a valid port number.

ModuleNotFoundError: No module named 'tornado' on ubuntu

When I am trying to run my application I got the following error
Traceback (most recent call last):
File "./app.py", line 32, in <module>
from pushservices.bootstrap import init_messaging_agents
File "/home/airnotifier/airnotifier/pushservices/bootstrap.py", line 2, in <module>
from .apns import *
File "/home/airnotifier/airnotifier/pushservices/apns.py", line 5, in <module>
from util import json_encode
File "/home/airnotifier/airnotifier/util.py", line 37, in <module>
import tornado
ModuleNotFoundError: No module named 'tornado'
I tried to run this command to install tornado
python3 -m pip install tornado
then I got the following message
Requirement already satisfied: tornado in /usr/local/lib/python3.8/dist-packages (6.0.3)
followed by the following error log
--- Logging error ---
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/utils/logging.py", line 177, in emit
self.console.print(renderable, overflow="ignore", crop=False, style=style)
File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/rich/console.py", line 1752, in print
extend(render(renderable, render_options))
File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/rich/console.py", line 1390, in render
for render_output in iter_render:
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/utils/logging.py", line 134, in __rich_console__
for line in lines:
File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/rich/segment.py", line 245, in split_lines
for segment in segments:
File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/rich/console.py", line 1368, in render
renderable = rich_cast(renderable)
File "/usr/local/lib/python3.8/dist-packages/pip/_vendor/rich/protocol.py", line 36, in rich_cast
renderable = cast_method()
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/self_outdated_check.py", line 130, in __rich__
pip_cmd = get_best_invocation_for_this_pip()
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/utils/entrypoints.py", line 58, in get_best_invocation_for_this_pip
if found_executable and os.path.samefile(
File "/usr/lib/python3.8/genericpath.py", line 101, in samefile
s2 = os.stat(f2)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/pip3.8'
Call stack:
File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.8/dist-packages/pip/__main__.py", line 31, in <module>
sys.exit(_main())
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/cli/main.py", line 70, in main
return command.main(cmd_args)
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/cli/base_command.py", line 101, in main
return self._main(args)
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/cli/base_command.py", line 223, in _main
self.handle_pip_version_check(options)
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/cli/req_command.py", line 148, in handle_pip_version_check
pip_self_version_check(session, options)
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/self_outdated_check.py", line 237, in pip_self_version_check
logger.info("[present-rich] %s", upgrade_prompt)
File "/usr/lib/python3.8/logging/__init__.py", line 1446, in info
self._log(INFO, msg, args, **kwargs)
File "/usr/lib/python3.8/logging/__init__.py", line 1589, in _log
self.handle(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1599, in handle
self.callHandlers(record)
File "/usr/lib/python3.8/logging/__init__.py", line 1661, in callHandlers
hdlr.handle(record)
File "/usr/lib/python3.8/logging/__init__.py", line 954, in handle
self.emit(record)
File "/usr/local/lib/python3.8/dist-packages/pip/_internal/utils/logging.py", line 179, in emit
self.handleError(record)
Message: '[present-rich] %s'
Arguments: (UpgradePrompt(old='22.1.2', new='22.2.2'),)
can anyone please tell me what should I do and what is the problem ?
Here's a possible scenario that could cause this:
you execute pip install tornado as a user but you run the tornado project as another user.
Sorry for my terrible english, hope you can understand

Module 'cryptography.utils' has no attribute 'bit_length'

I am currently trying to figure out how to use netmiko to automate some of my routine work.Such as getting configuration backup, creating vlans etc.I've managed to use it on Aruba and Huawei Switches without problem.But on alcatel switch I'm facing this issue:
Unknown exception: module 'cryptography.utils' has no attribute 'bit_length'
Traceback (most recent call last):
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\transport.py", line 2075, in run
self.kex_engine.parse_next(ptype, m)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\kex_gex.py", line 101, in parse_next
return self._parse_kexdh_gex_reply(m)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\kex_gex.py", line 281, in _parse_kexdh_gex_reply
self.transport._verify_key(host_key, sig)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\transport.py", line 1886, in _verify_key
if not key.verify_ssh_sig(self.H, Message(sig)):
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\dsskey.py", line 148, in verify_ssh_sig
key = dsa.DSAPublicNumbers(
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\cryptography\hazmat\primitives\asymmetric\dsa.py", line 212, in public_key
return backend.load_dsa_public_numbers(self)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\cryptography\hazmat\backends\openssl\backend.py", line 871, in load_dsa_public_numbers
dsa._check_dsa_parameters(numbers.parameter_numbers)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\netmiko\tplink\tplink_jetstream.py", line 145, in _override_check_dsa_parameters
if crypto_utils.bit_length(parameters.q) not in [160, 256]:
AttributeError: module 'cryptography.utils' has no attribute 'bit_length'
Traceback (most recent call last):
File "C:\Users\melih.celik\Desktop\New_Backup\Yedek\Coding\Rand stuff\ssh_deneme(toplu).py", line 75, in
config_backup(cihaz_secim,ip_address,username,password)
File "C:\Users\melih.celik\Desktop\New_Backup\Yedek\Coding\Rand stuff\ssh_deneme(toplu).py", line 12, in config_backup
net_connect=ConnectHandler(**switch) #Baglanti kuruldu.
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\netmiko\ssh_dispatcher.py", line 312, in ConnectHandler
return ConnectionClass(*args, **kwargs)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\netmiko\base_connection.py", line 346, in init
self._open()
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\netmiko\base_connection.py", line 351, in _open
self.establish_connection()
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\netmiko\base_connection.py", line 920, in establish_connection
self.remote_conn_pre.connect(**ssh_connect_params)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\client.py", line 406, in connect
t.start_client(timeout=timeout)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\transport.py", line 660, in start_client
raise e
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\transport.py", line 2075, in run
self.kex_engine.parse_next(ptype, m)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\kex_gex.py", line 101, in parse_next
return self._parse_kexdh_gex_reply(m)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\kex_gex.py", line 281, in _parse_kexdh_gex_reply
self.transport._verify_key(host_key, sig)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\transport.py", line 1886, in _verify_key
if not key.verify_ssh_sig(self.H, Message(sig)):
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\paramiko\dsskey.py", line 148, in verify_ssh_sig
key = dsa.DSAPublicNumbers(
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\cryptography\hazmat\primitives\asymmetric\dsa.py", line 212, in public_key
return backend.load_dsa_public_numbers(self)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\cryptography\hazmat\backends\openssl\backend.py", line 871, in load_dsa_public_numbers
dsa._check_dsa_parameters(numbers.parameter_numbers)
File "C:\Users\melih.celik\AppData\Local\Programs\Python\Python39\lib\site-packages\netmiko\tplink\tplink_jetstream.py", line 145, in _override_check_dsa_parameters
if crypto_utils.bit_length(parameters.q) not in [160, 256]:
AttributeError: module 'cryptography.utils' has no attribute 'bit_length'
Thanks for your help in advance.
It looks like tplink_jetstream.py assumes that a (now removed) helper function is available to it. The simplest fix here would be to go into that file and modify the line containing crypto_utils.bit_length(parameters.q) to read parameters.q.bit_length() instead.

GAE can't generate discovery file

I upgraded my GAE SDK to Version 1.8.5 and cannot generate a discovery file anymore with endpointscfg.py gen_discovery_doc -o.-f rpc .../main.FlyFlap.APi
I get the errors below.
I tried to delete the file google_appengine/lib/cacerts/urlfetch_cacerts.txt and certs.txt like it is suggested here, but it didn't help. Does someone got same problems?
Traceback (most recent call last):
File "/usr/local/bin/endpointscfg.py", line 196, in <module>
run_file(__file__, globals())
File "/usr/local/bin/endpointscfg.py", line 192, in run_file
execfile(script_path, globals_)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/endpointscfg.py", line 472, in <module>
sys.exit(main(sys.argv))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/endpointscfg.py", line 467, in main
args.callback(args)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/endpointscfg.py", line 348, in _GenDiscoveryDocCallback
output_path, hostname=hostname)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/endpointscfg.py", line 188, in GenDiscoveryDoc
service_configs = GenApiConfig(service_class_names, hostname=hostname)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/endpointscfg.py", line 144, in GenApiConfig
module_name, base_service_class_name = service_class_name.rsplit('.', 1)
ValueError: need more than 1 value to unpack
updated osx and it works again.

Categories

Resources