Error while import novaclient library to python - python

I am importing novalient API library to python 2.7.3 as follows
from novaclient.v1_1 import client
when i try this this , it gives me following error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/novaclient/__init__.py", line 18, in <module>
__version__ = pbr.version.VersionInfo('python-novaclient').version_string()
File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 78, in version_string
for part in self.release_string().split('.'):
File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 70, in release_string
self.release = self._get_version_from_pkg_resources()
File "/usr/local/lib/python2.7/dist-packages/pbr/version.py", line 62, in _get_version_from_pkg_resources
return packaging.get_version(self.package)
File "/usr/local/lib/python2.7/dist-packages/pbr/packaging.py", line 861, in get_version
version = _get_version_from_git(pre_version)
File "/usr/local/lib/python2.7/dist-packages/pbr/packaging.py", line 802, in _get_version_from_git
git_dir = _get_git_directory()
File "/usr/local/lib/python2.7/dist-packages/pbr/packaging.py", line 215, in _get_git_directory
return _run_shell_command(['git', 'rev-parse', '--git-dir'])
File "/usr/local/lib/python2.7/dist-packages/pbr/packaging.py", line 204, in _run_shell_command
env=newenv)
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
how to solve this issue? Is this a version related issue ?

You can read more about pbr (Python Build Reasonableness) here: http://docs.openstack.org/developer/pbr/

Related

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

Python: OSError: cannot open shared object file: No such file or directory on Ubuntu 20.04

I have been using the library misty for one month and it's working on my personal laptop. But when I am trying to make it work on the another device it gives an error:
Traceback (most recent call last):
File "client.py", line 577, in <module>
main()
File "client.py", line 558, in main
this_device, args.ini.address,
File "client.py", line 57, in __init__
MSTPSimpleApplication.__init__(self, *args)
File "/###/###/venv/lib/python3.7/python3.7/site-packages/misty/mstplib/__init__.py", line 531, in __init__
self.mux = MSTPMultiplexer(self.localDevice, self.localAddress)
File "/###/###/venv/lib/python3.7/python3.7/site-packages/misty/mstplib/__init__.py", line 428, in __init__
self.directPort = MSTPDirector(self.localDevice, self.address)
File "/###/###/venv/lib/python3.7/python3.7/site-packages/misty/mstplib/__init__.py", line 203, in __init__
mstp_lib = cdll.LoadLibrary(libmstp_path)
File "/usr/lib/python3.7/ctypes/__init__.py", line 442, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python3.7/ctypes/__init__.py", line 364, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /###/###/venv/lib/python3.7/site-packages/misty/mstplib/libmstp_agent.so: cannot open shared object file: No such file or directory
How can I fix this?
Thanks in anticipation.

Error in converting a dotfile to image by graphviz

I made a tree graph by anytree module and I want to get a png file out of it. I tried graphviz (dotfile to png) but got an error:
What is the problem?
Traceback (most recent call last):
File "<pyshell#14>", line 1, in <module>
BOM.treegraph()
File "C:\Users\Ali\Downloads\test.test.succ4.py", line 33, in treegraph
DotExporter (vars()[BOM.a[0].product]).to_picture ('udo.png')
File "C:\Users\Ali\AppData\Local\Programs\Python\Python37-32\lib\site-packages\anytree\exporter\dotexporter.py", line 232, in to_picture
check_call(cmd)
File "C:\Users\Ali\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 342, in check_call
retcode = call(*popenargs, **kwargs)
File "C:\Users\Ali\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 323, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Users\Ali\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "C:\Users\Ali\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 1178, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

pyglet errors for python3

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.

Categories

Resources