I'm having an import module issue. I'm using python 3.7.2 on windows 10.
When I trie to import the websockets module (I just write import websockets in the python shell), I have this error :
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Simon\AppData\Local\Programs\Python\Python37-32\lib\site-packages\websockets\__init__.py", line 16, in <module>
+ uri.__all__
NameError: name 'client' is not defined
I tried to download the websockets module last version but the error remains.
PS : English is not my native language, sorry for the phrasing
Related
I made a library named converttxttoxml (https://pypi.org/project/converttxttoxml/0.0.2/) but everytime someone tries to run it a error of module not found pops up after successful installation of library.
import converttxttoxml
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'converttxttoxml'
But running totally fine in my pc.
I just installed the python stanford nlp which went fine :-
pip install stanfordnlp
from a python shell, I am trying to instantiate the package and I get the following error :-
>>> import stanfordnlp
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/shivajidutta/anaconda/lib/python2.7/site-packages/stanfordnlp/__init__.py", line 1, in <module>
from stanfordnlp.pipeline.core import Pipeline
File "/Users/shivajidutta/anaconda/lib/python2.7/site-packages/stanfordnlp/pipeline/core.py", line 9, in <module>
from stanfordnlp.pipeline.doc import Document
File "/Users/shivajidutta/anaconda/lib/python2.7/site-packages/stanfordnlp/pipeline/doc.py", line 175
return f"<{self.__class__.__name__} index={self.index};words={self.words}>"
^
SyntaxError: invalid syntax
The line:
return f"<{self.__class__.__name__} index={self.index};words={self.words}>"
Indicates that the package is intended for Python 3.6 or higher. It is returning an f-string, which was introduced in version 3.6. You are running on version 2.7.
Time to upgrade?
I am a beginner and learning Python. I have setup the environment with SublimeText and Python3.x
I am fine in creating code on Sublime and building it locally through Ctrl+B and for input() function I installed SublimeREPL and it works find up till now.
The issue I am facing is on Python interpreter. I am facing below error while import any package:
import tweepy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tweepy'
I cannot even run a Python script from there. My Python path is below:
C:\Users\waqas.FVC\AppData\Local\Programs\Python\Python37-32
Demo.py and hello.py are the two scripts I wrote initially which I am trying to execute from Python Terminal, but it is showing below errors:
test.py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'test' is not defined
Demo.py
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'Demo' is not defined
The initial Python download includes a number of libraries, but there are many, many more that must be downloaded and installed separately. Tweepy is among those libraries.
You can find, and download, tweepy from here:
https://pypi.org/project/tweepy/
I have installed imagescanner module on windows following this steps . I have connected to scanner on wifi . When I try this code :
from imagescanner import ImageScanner
iscanner = ImageScanner()
scanners = iscanner.list_scanners()
print(scanners[0])
an error message occured :
C:\Python3.4\python.exe C:/Users/PB/PycharmProjects/ImageScanner/deneme.py
Traceback (most recent call last):
File "C:/Users/PB/PycharmProjects/ImageScanner/deneme.py", line 4, in <module>
from imagescanner import ImageScanner
File "C:\Python3.4\lib\site-packages\imagescanner-0.9-py3.4.egg\imagescanner\__init__.py", line 2, in <module>
from imagescanner.core._imagescanner import ImageScanner
File "C:\Python3.4\lib\site-packages\imagescanner-0.9-py3.4.egg\imagescanner\core\_imagescanner.py", line 61
except Exception, exc:
^
SyntaxError: invalid syntax
Process finished with exit code 1
As far as I know, imagescanner isn't compatible with Python 3.
You can try to fix it. The SyntaxError refers to the old syntax for exceptions ("class, variable" become "class as variable" in newer versions). But I'm not sure what other problems you can find.
I installed a module one month ago. At that time, I could import the module successfully.
Now, when I import this module, there is an ImportError,
>>> import anuga
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/lili/anuga_core/source/anuga/__init__.py", line 110, in <module> from anuga.file_conversion.urs2nc import urs2nc
File "/home/lili/anuga_core/source/anuga/file_conversion/urs2nc.py", line 12, in <module>
from mux import WAVEHEIGHT_MUX_LABEL, EAST_VELOCITY_LABEL, \
ImportError: No module named mux
How could I solve this problem?
ImportError comes only when the module is not available in the list called sys.path. Since the current operating system is Linux based (I got an idea from the error message /home/lili), it is required to have mux.py in the path (i.e, sys.path). The mux.py file will be exactly similar to the file available in this link.
`https://anuga.anu.edu.au/svn/anuga/trunk/anuga_core/source/anuga/file/mux.py`
All these problems come when the installation of ANUGA is not proper.