I have been trying to install pysmell in vscode but there seem to generate this error whenever i do that. Can someone help me understand and resolve this. Thank you!
Traceback (most recent call last):
File "C:\Users\abhil\AppData\Local\Programs\Python\Python39\Scripts\pysmell-script.py", line 33, in <module>
sys.exit(load_entry_point('pysmell', 'console_scripts', 'pysmell'))
File "C:\Users\abhil\AppData\Local\Programs\Python\Python39\Scripts\pysmell-script.py", line 25, in importlib_load_entry_point
return next(matches).load()
File "C:\Users\abhil\AppData\Local\Programs\Python\Python39\lib\importlib\metadata.py", line 77, in load
module = import_module(match.group('module'))
File "C:\Users\abhil\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "C:\Users\abhil\AppData\Local\Programs\Python\Python39\lib\site-packages\pysmell\tags.py", line 17, in <module>
from pysmell.codefinder import ModuleDict, processFile
File "C:\Users\abhil\AppData\Local\Programs\Python\Python39\lib\site-packages\pysmell\codefinder.py", line 13, in <module>
import __builtin__
ModuleNotFoundError: No module named '__builtin__'
I was following this link (https://code.google.com/archive/p/pysmell/) for the installation process. I have already done python setup.py install and python setup.py develop. the problem is in the import pysmell part.
Pysmell uses the module __builtin__, which was renamed to builtins in Python 3. You might have to switch to Python 2, or find a different alternative to Pysmell.
Related
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "D:\screener\screener\urls.py", line 15, in <module>
from userbase import views as user_views
File "D:\screener\userbase\views.py", line 26, in <module>
from .forms import (
File "D:\screener\userbase\forms.py", line 4, in <module>
from .import_companies import get_codes_from_file
File "D:\screener\userbase\import_companies.py", line 4, in <module>
from utilities.file_to_text import get_text
File "D:\screener\utilities\file_to_text.py", line 3, in <module>
import pdftotext
ImportError: DLL load failed: The specified module could not be found.
I installed folling https://coder.haus/2019/09/27/installing-pdftotext-through-pip-on-windows-10/ , and tried reinstalling using pip command, also tried it inside conda but all yielded the same result
I am unable to import pdftotext, any way to get it done?
I recently upgraded my pip to 19.3. When I did that I cannot use any pip commands. OS - Mac
When I googled and researched more, most of the suggestions were to downgrade the pip package. However, even when I tried that I am getting the same result. In fact, force installs or uninstall or sudo commands nothing works.
Traceback (most recent call last):
File "/Users/.virtualenvs/myvenv/bin/pip", line 10, in <module>
sys.exit(main())
File "/Users/.virtualenvs/myvenv/lib/python3.7/site-packages/pip/_internal/main.py", line 45, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "/Users/.virtualenvs/myvenv/lib/python3.7/site-packages/pip/_internal/commands/__init__.py", line 96, in create_command
module = importlib.import_module(module_path)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/.virtualenvs/myvenv/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 24, in <module>
from pip._internal.cli.req_command import RequirementCommand
File "/Users/.virtualenvs/myvenv/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 21, in <module>
from pip._internal.operations.prepare import RequirementPreparer
File "/Users/.virtualenvs/myvenv/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 17, in <module>
from pip._internal.download import unpack_url
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "/Users/.virtualenvs/myvenv/lib/python3.7/site-packages/wrapt/importer.py", line 158, in load_module
notify_module_loaded(module)
File "/Users/.virtualenvs/myvenv/lib/python3.7/site-packages/wrapt/decorators.py", line 443, in _synchronized
return wrapped(*args, **kwargs)
File "/Users/.virtualenvs/myvenv/lib/python3.7/site-packages/wrapt/importer.py", line 136, in notify_module_loaded
hook(module)
File "/Users/.virtualenvs/myvenv/lib/python3.7/site-packages/pip_system_certs/wrapt_pip.py", line 8, in apply_patches
override_ssl_handler(download)
File "/Users/.virtualenvs/myvenv/lib/python3.7/site-packages/pip_system_certs/wrapt_pip.py", line 17, in override_ssl_handler
class SslContextHttpAdapter(download.HTTPAdapter):
AttributeError: module 'pip._internal.download' has no attribute 'HTTPAdapter'
Can somebody help, please?
This appears to be because you installed the pip-system-certs package, which hooks into pip internals in a way that was never supported. This promptly broke as soon as you updated pip and the stuff pip-system-certs wanted to mess with got changed.
You will at least need to get rid of pip-system-certs. It looks like it was installed in a virtualenv, so you can probably just deactivate the env and make a new one... but if so, it seems like you would have already tried that. If you didn't already try that, make sure to try it next time! If you did already try that, then you probably wrecked more stuff than we can see, and you may need more drastic measures, such as a full Python reinstall.
What worked for me was to go to <your conda environment>\Lib\site-packages and remove all occurences of pip-system-certs. In my case it was one file and two folders.
pip-tools~=4.2.0 is compatible with pip>=19.3
I did an installation on android using the follow commands on android:
apt install python
pip install scapy
everything is fine for now, but when i run scapy i got this error -----see error
This error does not happen to me in conda or kali, it appears to be exclusive for android.
ERROR: Loading module scapy.layers.netflow
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/scapy/main.py", line 143, in _load
mod = importlib.import_module(module)
File "/data/data/com.termux/files/usr/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/scapy/layers/netflow.py", line 112, in <module>
class NetflowRecordV5(Packet):
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/scapy/layers/netflow.py", line 127, in NetflowRecordV5
ByteEnumField("prot", IP_PROTOS["tcp"], IP_PROTOS),
File "/data/data/com.termux/files/usr/lib/python3.7/site-packages/scapy/dadict.py", line 49, in getitem
return getattr(self, attr)
AttributeError: 'DADict' object has no attribute 'tcp'
The android device is rooted. I hope someone is familiar with this error and can help. Thanks
i did this on my phone but it looks require root access
I need psutil in my code but I get the error "importError _psutil_linux" on Heroku
it's for a status application on the use of the system and what's left of free.
I've already tried:
- to force the installation with pip (not work)
- to change the version with the file requirements.txt (not work)
requirements.txt :
Unidecode==1.0.22
youtube_dl==2018.7.21
chardet==3.0.4
urlextract==0.8.3
feedparser==5.2.1
requests==2.18.4
setuptools==40.2.0
aiohttp==1.0.5
urllib3==1.22
discord.py==0.16.12
psutil==5.4.7
pip==9.0.3
pyparsing==2.2.0
Pillow==5.3.0
beautifulsoup4==4.6.3
httplib2==0.11.3
imgurpython==1.1.7
keyboard==0.13.2
google_api_python_client==1.7.4
pyfiglet==0.7.5
pylast==2.4.0
r6sapi==0.8.0
raven==6.9.0
raven_aiohttp==0.7.0
tabulate==0.8.2
typing==3.6.6
my use of psutil :
import psutil
CPU = psutil.cpu_percent()
RAM =psutil.virtual_memory().percent
(in a discord bot command.)
Traceback (most recent call last):
File "/app/cogs/owner.py", line 65, in load
self._load_cog(module)
File "/app/cogs/owner.py", line 946, in _load_cog
mod_obj = importlib.import_module(cogname)
File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/app/cogs/cyvgeneral.py", line 7, in <module>
import psutil
File "lib/psutil/__init__.py", line 100, in <module>
from . import _pslinux as _psplatform
File "lib/psutil/_pslinux.py", line 26, in <module>
from . import _psutil_linux as cext
ImportError: cannot import name '_psutil_linux'
I expect Psutil to load correctly.
thank you in advance.
I'm currently developing the service which should dynamically import python code files (modules) and call function in each of these modules AttributeError. The problem, if I understood the error correctly, lies in the fact that I'm importing the module Launcher (module which initiated importing of the module SomeModuleToImport) in the module SomeModuleToImport.
How can I resolve it?
Also I will need to reimport module each time I need it because the code in SomeModuleToImport can be changed during runtime.
Python version 3.6.1.
File structure:
|
- Launcher.py
- SomeModuleToImport.py
Launcher.py
import importlib
script = importlib.import_module("SomeModuleToImport")
script.handle()
def writeMsg(txt):
print(txt)
SomeModuleToImport.py
import Launcher
def handle(user, req):
Launcher.writeMsg("Hello!")
Error:
Traceback (most recent call last):
File "/Users/lexmint/Dropbox/Archive/Development/Breeze/Launcher.py", line 3, in <module>
script = importlib.import_module("unban")
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "/Users/lexmint/Dropbox/Archive/Development/Breeze/unban.py", line 1, in <module>
import Launcher
File "/Users/lexmint/Dropbox/Archive/Development/Breeze/Launcher.py", line 4, in <module>
script.handle()
AttributeError: module 'SomeModuleToImport' has no attribute 'handle'