ImportError: cannot import name 'AppCommandOptionType' from 'discord.enums' - discord

from discord import app_commands is throwing an ImportError.
Traceback (most recent call last):
File "c:\Users\darks\OneDrive\Робочий стіл\09999\323232.py", line 19, in <module>
from discord import app_commands
File "C:\Users\darks\AppData\Roaming\Python\Python311\site-packages\discord\app_commands\__init__.py", line 12, in <module>
from .commands import *
File "C:\Users\darks\AppData\Roaming\Python\Python311\site-packages\discord\app_commands\commands.py", line 51, in <module>
from ..enums import AppCommandOptionType, AppCommandType, ChannelType, Locale
ImportError: cannot import name 'AppCommandOptionType' from 'discord.enums' (C:\Users\darks\AppData\Roaming\Python\Python311\site-packages\discord\enums.py)

Related

OpenGauss environment installation problem

Traceback (most recent call last):
File "/opt/software/openGauss/script/gspylib/os/gsfile.py", line 31, in <module>
import psutil
File "/opt/software/openGauss/script/gspylib/os/../../../lib/psutil/__init__.py", line 95, in <module>
from . import _pslinux as _psplatform
File "/opt/software/openGauss/script/gspylib/os/../../../lib/psutil/_pslinux.py", line 26, in <module>
from . import _psutil_linux as cext
File "/opt/software/openGauss/script/gspylib/os/../../../lib/psutil/_psutil_linux.py", line 7, in <module>
__bootstrap__()
File "/opt/software/openGauss/script/gspylib/os/../../../lib/psutil/_psutil_linux.py", line 6, in __bootstrap__
imp.load_dynamic(__name__,__file__)
File "/usr/local/python3/lib/python3.7/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /opt/software/openGauss/script/gspylib/os/../../../lib/psutil/_psutil_linux.so: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "gs_preinstall", line 32, in <module>
from gspylib.common.DbClusterInfo import dbClusterInfo, \
File "/opt/software/openGauss/script/gspylib/common/DbClusterInfo.py", line 36, in <module>
from gspylib.os.gsfile import g_file
File "/opt/software/openGauss/script/gspylib/os/gsfile.py", line 65, in <module>
import psutil
File "/opt/software/openGauss/script/gspylib/os/../../../lib/psutil/__init__.py", line 95, in <module>
from . import _pslinux as _psplatform
File "/opt/software/openGauss/script/gspylib/os/../../../lib/psutil/_pslinux.py", line 26, in <module>
from . import _psutil_linux as cext
ImportError: /opt/software/openGauss/script/gspylib/os/../../../lib/psutil/_psutil_linux.so: cannot open shared object file: No such file or directory
The error is that the python dependency cannot be found. Look for the dependency package ‘psutil’

AttributeError: module 'collections' has no attribute 'Mapping'

not sure what to do
and having a tough time installing an older version of python
Traceback (most recent call last):
File "/home/g/.local/bin/cairo-compile", line 7, in <module>
from starkware.cairo.lang.compiler.cairo_compile import main # noqa
File "/home/g/.local/lib/python3.10/site-packages/starkware/cairo/lang/compiler/cairo_compile.py", line 9, in <module>
from starkware.cairo.lang.compiler.assembler import assemble
File "/home/g/.local/lib/python3.10/site-packages/starkware/cairo/lang/compiler/assembler.py", line 7, in <module>
from starkware.cairo.lang.compiler.program import CairoHint, Program
File "/home/g/.local/lib/python3.10/site-packages/starkware/cairo/lang/compiler/program.py", line 25, in <module>
from starkware.starkware_utils.marshmallow_dataclass_fields import IntAsHex
File "/home/g/.local/lib/python3.10/site-packages/starkware/starkware_utils/marshmallow_dataclass_fields.py", line 6, in <module>
from frozendict import frozendict
File "/home/g/.local/lib/python3.10/site-packages/frozendict/__init__.py", line 16, in <module>
class frozendict(collections.Mapping):
AttributeError: module 'collections' has no attribute 'Mapping'
❯ vim +16 /home/g/.local/lib/python3.10/site-packages/frozendict/__init__.py
and modified line 16 this way:
- class frozendict(collections.Mapping):
+ class frozendict(collections.abc.Mapping):
good as new :)

Can't generate an OpenAPI

I have been working through the tutorial: Getting started with Endpoints Frameworks for Python same as this person How do I fix OpenAPI document generation on Google Cloud Endpoints?
and I'm having a similar problem
Traceback (most recent call last):
File "lib/endpoints/endpointscfg.py", line 28, in <module>
from endpoints._endpointscfg_impl import main
File "/endpoints-frameworks-v2/echo/lib/endpoints/__init__.py", line 33, in <module>
from .apiserving import *
File "/endpoints-frameworks-v2/echo/lib/endpoints/apiserving.py", line 71, in <module>
from endpoints_management.control import client as control_client
File "/endpoints-frameworks-v2/echo/lib/endpoints_management/__init__.py", line 19, in <module>
from . import auth, config, control, gen
File "/endpoints-frameworks-v2/echo/lib/endpoints_management/auth/__init__.py", line 19, in <module>
from . import suppliers, tokens
File "/endpoints-frameworks-v2/echo/lib/endpoints_management/auth/suppliers.py", line 21, in <module>
from jwkest import jwk
File "/endpoints-frameworks-v2/echo/lib/jwkest/jwk.py", line 11, in <module>
from Crypto.PublicKey import RSA
File "/endpoints-frameworks-v2/echo/lib/Crypto/PublicKey/RSA.py", line 78, in <module>
from Crypto import Random
File "/endpoints-frameworks-v2/echo/lib/Crypto/Random/__init__.py", line 28, in <module>
from Crypto.Random import OSRNG
ImportError: cannot import name OSRNG
when I run this line with my project-ID
python lib/endpoints/endpointscfg.py get_openapi_spec main.EchoApi --hostname [YOUR_PROJECT_ID].appspot.com
any idea if this is a bug that can be fixed

GAE Launcher (Python) could not start

I believe this is related a number of python packages I have recently installed environmental variables that I have changed. I have re-installed Numpy and GAE, which did not help. So any suggestions on this? Thanks!
The GAE log indicated that the failure was lined to file import
2013-12-11 11:45:20 Running command: "['C:\\Python27\\pythonw.exe', 'C:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=8094', '--admin_port=8004', 'D:\\Dropbox\\ubertool_src']"
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py", line 197, in <module>
_run_file(__file__, globals())
File "C:\Program Files (x86)\Google\google_appengine\dev_appserver.py", line 193, in _run_file
execfile(script_path, globals_)
File "C:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\devappserver2.py", line 27, in <module>
import tempfile
File "C:\Python27\Lib\tempfile.py", line 34, in <module>
from random import Random as _Random
File "C:\Python27\Lib\site-packages\numpy\random\__init__.py", line 102, in <module>
ranf = random = sample = random_sample
NameError: name 'random_sample' is not defined
2013-12-11 11:45:21 (Process exited with code 1)
Update
just did a little test.
I can run from numpy import random
but if I run import random
The error msg is:
>>> import random
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\Lib\site-packages\numpy\random\__init__.py", line 102, in <module>
ranf = random = sample = random_sample
NameError: name 'random_sample' is not defined
Update
The problem is solved after removing C:\Python27\Lib\site-packages\numpy (I am not sure how this was added) from PYTHONPATH in Environmental Variable

How can I fix this error when executing GAE SDK in Ubuntu?

I was following the outlines of this guide (http://www.instructables.com/id/Aquaponics-Online-Temperature-and-Humidity/step3/Testing-GAE-SDK/), so I can try to innovate the design for my own aquaponic system.
However, when I typed "$ python2.7 AppEngine/dev_appserver.py IAquaponics_DHT/myapsystem" into my terminal, I received an error: http://i.imgur.com/ueO4MA1.jpg (my stacktrace is below).
note: "__" is to blank out my name.
____#____-Linux:~$ python2.7 AppEngine/dev_appserver.py
Traceback (most recent call last):
File "AppEngine/dev_appserver.py", line 182, in <module>
_run_file(__file__, globals())
File "AppEngine/dev_appserver.py", line 178, in _run_file
execfile(script_path, globals_)
File "/home/____/AppEngine/google/appengine/tools/devappserver2/devappserver2.py", line 32, in <module>
from google.appengine.tools.devappserver2.admin import admin_server
File "/home/____/AppEngine/google/appengine/tools/devappserver2/admin/admin_server.py", line 25, in <module>
import webapp2
File "/home/____/AppEngine/lib/webapp2-2.5.1/webapp2.py", line 25, in <module>
import webob
File "/home/____/AppEngine/lib/webob-1.2.3/webob/__init__.py", line 3, in <module>
from webob.response import *
File "/home/____/AppEngine/lib/webob-1.2.3/webob/response.py", line 9, in <module>
import zlib
ImportError: No module named zlib
Have you tried (run enter this in the terminal window to install the install a package for zlib)
sudo apt-get install zlib
start there

Resources