I have tried following
when I tried to import the class from the file named plyparser.py of pycparser(https://github.com/eliben/pycparser/blob/master/pycparser/plyparser.py)
using the following statement
from pycparser.plyparser import Coord
But, I am unable to import function parameterized from plyparser of pycparser using the following statement
from pycparser.plyparser import parameterized
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name parameterized
How to resolve this issue.
Related
I was using a tkform(https://github.com/boscoh/tkform) with Python2 and it was working perfectly.
After switching to Python3, Im unable to run it, specifically the part:
from idlelib.WidgetRedirector import WidgetRedirector
It seems that WidgetRedirecor.py not even in the library (idellib) anymore...
Traceback (most recent call last):
File "/Users/igor/opt/cymorph3/runCyMorphGUI.py", line 7, in <module>
import tkform
File "gui/tkform.py", line 22, in <module>
from idlelib import WidgetRedirector
ImportError: cannot import name 'WidgetRedirector' from 'idlelib' (/Users/igor/opt/anaconda3/envs/cyMorph3/lib/python3.9/idlelib/__init__.py)
Can I fix it somehow?
Use:
from idlelib.redirector import WidgetRedirector
I want to use libxmp.
I used:
import sys
sys.path.append('/usr/local/lib/python3.8/dist-packages')
which directly locate to libxmp
from libxmp import XMPFiles, consts
from libxmp.utils import file_to_dict
upper code box is the import part
I faced this problem:
Traceback (most recent call last):
File "/home/webprime/jython/jython/jython.py", line 5, in <module>
from libxmp import XMPFiles, consts
File "/usr/local/lib/python3.8/dist-packages/libxmp/__init__.py", line 37, in <module>
from ctypes import util
ImportError: cannot import name util
it works on Python 3.
Cant set the process in Python 2.7.17 pwntools.
Source code:
from pwn import *
s=process('/root/Dokumente/Scripts/example_program')
I tried from pwn import *:
root#bitpc:~# python pwn.py
Traceback (most recent call last):
File "pwn.py", line 1, in <module>
from pwn import *
File "/root/pwn.py", line 2, in <module>
s=process('/root/Dokumente/Scripts/example_program')
NameError: name 'process' is not defined
That was not working. Then i imported process directly:
root#bitpc:~# python pwn.py
Traceback (most recent call last):
File "pwn.py", line 1, in <module>
from pwn import process
File "/root/pwn.py", line 1, in <module>
from pwn import process
ImportError: cannot import name process
I got an import error. How to fix this?
It seems that your exploit script's name is pwn.py. rename it to some other name such as exp.py. otherwise python will try to import things in your pwn.py instead of importing things from pwntools.
I'm getting this error when trying to using polyglot library for the first time.
from polyglot.text import Text, Word
word = Text("Preprocessing is an essential step.").words[0]
print(word.morphemes)
here is the full error message.
Traceback (most recent call last):
File "/home/adeesha/PycharmProjects/theme_recomend/plyglot.py", line 2, in <module>
from polyglot.text import Text, Word
File "/usr/local/lib/python3.5/dist-packages/polyglot-16.7.4-py3.5.egg/polyglot/__init__.py", line 12, in <module>
from .base import Sequence, TokenSequence
File "/usr/local/lib/python3.5/dist-packages/polyglot-16.7.4-py3.5.egg/polyglot/base.py", line 9, in <module>
from concurrent.futures import ProcessPoolExecutor, as_completed
ImportError: cannot import name 'ProcessPoolExecutor'
the version of Python 3.5.2
how I gonna solve this problem?
For some reason I receive an ImportError every time I try to import a class from another file. Here's the github page for my project: https://github.com/wheelebin/mcnextbot
Here's the error that I'm receiving:
Traceback (most recent call last):
File "ircbot.py", line 36, in <module>
from test import mcnextlvl
ImportError: cannot import name mcnextlvl
Here your from test import something refers to the module test in <PYTHONPATH>/lib, not yourselves test.py, and there is no submodule/class mcnextlvl there. You should use from lib.test import mcnextlvl as #sgmart commented.
The __init__.py python file allow you can import your individual modules named 'test' from the lib package.