import ed25519._ed25519 works in powershell but not GAE - python

Does anyone have suggestions as to why I am getting the error below when using GAE and not with powershell? pip install comes back with requirement is already satisfied.
Traceback (most recent call last):
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\runtime\wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\runtime\wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\runtime\wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "C:\Users\kunle\Documents\LAGOS_BUSINESS\ISHOPEAZYV2\iShopEazyV2WebApp\ishopeazy.py", line 21, in <module>
from stellar_base.keypair import Keypair
File "C:\Users\kunle\Documents\LAGOS_BUSINESS\ISHOPEAZYV2\iShopEazyV2WebApp\lib\stellar_base\keypair.py", line 7, in <module>
from .utils import XdrLengthError, decode_check, encode_check
File "C:\Users\kunle\Documents\LAGOS_BUSINESS\ISHOPEAZYV2\iShopEazyV2WebApp\lib\stellar_base\utils.py", line 15, in <module>
import ed25519
File "C:\Users\kunle\Documents\LAGOS_BUSINESS\ISHOPEAZYV2\iShopEazyV2WebApp\lib\ed25519\__init__.py", line 1, in <module>
from .keys import (BadSignatureError, BadPrefixError,
File "C:\Users\kunle\Documents\LAGOS_BUSINESS\ISHOPEAZYV2\iShopEazyV2WebApp\lib\ed25519\keys.py", line 3, in <module>
from . import _ed25519
File "C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine\google\appengine\tools\devappserver2\python\runtime\sandbox.py", line 1093, in load_module
raise ImportError('No module named %s' % fullname)
ImportError: No module named ed25519._ed25519

You cannot import C extension modules into a GAE application. ed25519._ed25519 is an extension module written in C.
You must find an implementation of Ed25519 that doesn't require the use of a C extension.

Related

How Do I get rid of this error:Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Program?

I keep trying to start my python backend with uvicorn main:app --reload but I keep getting this error:
INFO: Will watch for changes in these directories: ['C:\\Users\\darkg\\OneDrive\\Desktop\\loginpage\\FastAP_BackEnd\\books']
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [532] using StatReload
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\multiprocessing\spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\multiprocessing\spawn.py", line 126, in _main
self = reduction.pickle.load(from_parent)
File "C:\Users\darkg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\uvicorn\__init__.py", line 1, in <module>
from uvicorn.config import Config
File "C:\Users\darkg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\uvicorn\config.py", line 1, in <module>
import asyncio
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\asyncio\__init__.py", line 8, in <module>
from .base_events import *
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 18, in <module>
import concurrent.futures
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\concurrent\futures\__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\concurrent\futures\_base.py", line 7, in <module>
import logging
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\logging\__init__.py", line 26, in <module>
import sys, os, time, io, re, traceback, warnings, weakref, collections.abc
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\traceback.py", line 5, in <module>
import linecache
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\linecache.py", line 11, in <module>
import tokenize
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\tokenize.py", line 35, in <module>
from token import *
File "C:\Users\darkg\OneDrive\Desktop\loginpage\FastAP_BackEnd\books\.\token.py", line 5, in <module>
from . import schemas
ImportError: attempted relative import with no known parent package
I tried starting it with python -m uvicorn main:app --reload
but I get this error instead
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 187, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 146, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 110, in _get_module_details
__import__(pkg_name)
File "C:\Users\darkg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\uvicorn\__init__.py", line 1, in <module>
from uvicorn.config import Config
File "C:\Users\darkg\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\uvicorn\config.py", line 1, in <module>
import asyncio
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\asyncio\__init__.py", line 8, in <module>
from .base_events import *
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\asyncio\base_events.py", line 18, in <module>
import concurrent.futures
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\concurrent\futures\__init__.py", line 8, in <module>
from concurrent.futures._base import (FIRST_COMPLETED,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\concurrent\futures\_base.py", line 7, in <module>
import logging
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\logging\__init__.py", line 26, in <module>
import sys, os, time, io, re, traceback, warnings, weakref, collections.abc
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\traceback.py", line 5, in <module>
import linecache
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\linecache.py", line 11, in <module>
import tokenize
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\tokenize.py", line 35, in <module>
from token import *
File "C:\Users\darkg\OneDrive\Desktop\loginpage\FastAP_BackEnd\books\token.py", line 5, in <module>
from . import schemas
ImportError: attempted relative import with no known parent package
Here is the main code
from . import models
from fastapi import FastAPI
from .database import engine
from .routers import books, users,authentication
app=FastAPI()
models.Base.metadata.create_all(engine)
app.include_router(books.router)
app.include_router(users.router)
app.include_router(authentication.router)
Here is my Code File Path If that helps solve the issue :
Code File Structure
I have tried everything but cant seem to find a way to fix this . I've redowloaded python. I've reinstalled every package, ive added paths to my packages, but nothing seems to work. Any help would be greatly appreciated. I am completely lost
Python doesn't know that the directory containing your modules (including main.py) is a package, therefore it can't properly locate imports. Create an empty __init__.py file in this directory to mark it as a regular package.
A rule of thumb is to mark all your directories that contain python modules as packages with this method.
There's another type of Python packages that may make your code sometimes work: namespace packages. They don't have to contain an __init__.py file. I recommend to just avoid them, unless you understand exactly what they're for and why you need them. [Doc reference]
For a quick reference, search through the FastAPI documentation for "project file structure" (it may be called something similar).

Python No module named 'Input'

my error is
Traceback (most recent call last):
File "/home/shin/.local/bin/fextractor", line 4, in <module>
__import__('pkg_resources').run_script('VDiscover==0.1', 'fextractor')
File "/home/shin/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 672, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/home/shin/.local/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1472, in run_script
exec(code, namespace, namespace)
File "/home/shin/.local/lib/python3.8/site-packages/VDiscover-0.1-py3.8.egg/EGG-INFO/scripts/fextractor", line 28, in <module>
from vdiscover.Detection import GetArgs, GetFiles, GetCmd
File "/home/shin/.local/lib/python3.8/site-packages/VDiscover-0.1-py3.8.egg/vdiscover/Detection.py", line 24, in <module>
from Input import Arg, File
ModuleNotFoundError: No module named 'Input'
I think it is related to the input library, so I did pip install input and added the path(./.local/lib/python3.8/site-packages) to the PATH.
But it seems to be a different issue. Could I possibly know a solution?

Brownie error Cannot load native module 'Crypto.Util._cpuid_c'

Brownie was working great yesterday. Today I get this error. Anyone have a solution?
PS C:\Users\philk\demos\web3_py_simple_storage> brownie --version
INFO: Could not find files for the given pattern(s).
Traceback (most recent call last):
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 197, in run_module_as_main
return run_code(code, main_globals, None,
File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2544.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in run_code
exec(code, run_globals)
File "C:\Users\philk.local\pipx\venvs\eth-brownie\Scripts\brownie.exe_main.py", line 4, in
File "C:\Users\philk.local\pipx\venvs\eth-brownie\lib\site-packages\brownie_init.py", line 6, in
from brownie.project import compile_source, run
File "C:\Users\philk.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\project_init.py", line 3, in
from .main import ( # NOQA 401
File "C:\Users\philk.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\project\main.py", line 45, in
from brownie.network import web3
File "C:\Users\philk.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network_init_.py", line 4, in
from .account import Accounts
File "C:\Users\philk.local\pipx\venvs\eth-brownie\lib\site-packages\brownie\network\account.py", line 13, in
import eth_account
File "C:\Users\philk.local\pipx\venvs\eth-brownie\lib\site-packages\eth_account_init_.py", line 1, in
from eth_account.account import (
File "C:\Users\philk.local\pipx\venvs\eth-brownie\lib\site-packages\eth_account\account.py", line 11, in
from eth_keyfile import (
File "C:\Users\philk.local\pipx\venvs\eth-brownie\lib\site-packages\eth_keyfile_init_.py", line 7, in
from eth_keyfile.keyfile import ( # noqa: F401
File "C:\Users\philk.local\pipx\venvs\eth-brownie\lib\site-packages\eth_keyfile\keyfile.py", line 6, in
from Crypto.Cipher import AES
File "C:\Users\philk.local\pipx\venvs\eth-brownie\lib\site-packages\Crypto\Cipher_init_.py", line 36, in
from Crypto.Cipher._mode_gcm import _create_gcm_cipher
File "C:\Users\philk.local\pipx\venvs\eth-brownie\lib\site-packages\Crypto\Cipher_mode_gcm.py", line 51, in
from Crypto.Util import _cpu_features
File "C:\Users\philk.local\pipx\venvs\eth-brownie\lib\site-packages\Crypto\Util_cpu_features.py", line 34, in
_raw_cpuid_lib = load_pycryptodome_raw_lib("Crypto.Util._cpuid_c",
File "C:\Users\philk.local\pipx\venvs\eth-brownie\lib\site-packages\Crypto\Util_raw_api.py", line 309, in load_pycryptodome_raw_lib
raise OSError("Cannot load native module '%s': %s" % (name, ", ".join(attempts)))
OSError: Cannot load native module 'Crypto.Util._cpuid_c': Not found '_cpuid_c.cp39-win_amd64.pyd', Not found '_cpuid_c.pyd'
I rebooted but problem still persisted. I uninstalled brownie and reinstalled
pipx uninstall eth-brownie
pipx install eth-brownie
I was prompted with missing path
C:\Users\username.local\bin"
so i added it
works now.

What does "SyntaxError: invalid syntax" mean in an Odoo application?

I am facing below error in Odoo application:
"C:\Program Files (x86)\Odoo 12.0\python\python.exe" "C:/Program Files (x86)/Odoo 12.0/server/odoo-bin" -c D:\config_odoo\config.txt -d Duy123
Traceback (most recent call last):
File "C:/Program Files (x86)/Odoo 12.0/server/odoo-bin", line 5, in <module>
import odoo
File "C:\Program Files (x86)\Odoo 12.0\server\odoo\__init__.py", line 125, in <module>
from . import modules
File "C:\Program Files (x86)\Odoo 12.0\server\odoo\modules\__init__.py", line 8, in <module>
from . import db, graph, loading, migration, module, registry
File "C:\Program Files (x86)\Odoo 12.0\server\odoo\modules\graph.py", line 10, in <module>
import odoo.tools as tools
File "C:\Program Files (x86)\Odoo 12.0\server\odoo\tools\__init__.py", line 9, in <module>
from .misc import *
File "C:\Program Files (x86)\Odoo 12.0\server\odoo\tools\misc.py", line 26, in <module>
import werkzeug.utils
File "C:\Program Files (x86)\Odoo 12.0\python\lib\site-packages\werkzeug\__init__.py", line 152, in <module>
__import__('werkzeug.exceptions')
File "C:\Program Files (x86)\Odoo 12.0\python\lib\site-packages\werkzeug\exceptions.py", line 71, in <module>
from werkzeug.wrappers import Response
File "C:\Program Files (x86)\Odoo 12.0\python\lib\site-packages\werkzeug\wrappers.py", line 26, in <module>
from werkzeug.http import HTTP_STATUS_CODES, \
File "C:\Program Files (x86)\Odoo 12.0\python\lib\site-packages\werkzeug\http.py", line 26, in <module>
from urllib2 import parse_http_list as _parse_list_header
File "C:\Program Files (x86)\Odoo 12.0\python\lib\site-packages\urllib2.py", line 220
raise AttributeError, attr
^
SyntaxError: invalid syntax
Process finished with exit code 1
This is a general Python error. It's telling you that there's an error in your module's code.
According to the logs, it seems like you're trying to use a module written for an older Odoo version into 0doo 12. In general terms, that's a bad idea, and you're seeing why.

Numpy fails to import except in Admin command prompt

I recently updated numpy on Windows using pip and encountered a strange problem. After the update when I run python from an Admin prompt and import numpy, it works fine. But when I import it from a normal non-admin prompt, I get this error:
>>> import numpy
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import numpy
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\numpy\__init__.py", line 190, in <module>
from . import add_newdocs
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\numpy\lib\__init__.py", line 9, in <module>
from .index_tricks import *
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\numpy\lib\index_tricks.py", line 12, in <module>
from . import function_base
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\numpy\lib\function_base.py", line 2489, in <module>
def corrcoef(x, y=None, rowvar=1, bias=np._NoValue, ddof=np._NoValue):
AttributeError: module 'numpy' has no attribute '_NoValue'
And when I tried again it changes to
>>> import numpy
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import numpy
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\numpy\__init__.py", line 190, in <module>
from . import add_newdocs
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\numpy\lib\__init__.py", line 9, in <module>
from .index_tricks import *
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\numpy\lib\index_tricks.py", line 6, in <module>
import numpy.core.numeric as _nx
AttributeError: module 'numpy' has no attribute 'core'
All the library files are in the file system although it sounds like it is unable to find numpy.core.
One possibly relevant fact is that python is installed in C:\Program Files (x86)\Python 3.5 rather than in the root directory. (This is the default install location as of 3.5, but has caused minor problems before.) I wonder if there could be a problem with file or directory permissions?
Also I tried reinstalling and even downgrading back to 1.10.4 (using the binary here and the problem persisted, although it wasn't there before the upgrade, and I installed it from the same source.
Any ideas on what the issue is?

Categories