for some reason I get an error at the line containing this piece of code:
t1 = threading.Thread(target=socket)
this is the error:
Traceback (most recent call last):
File "D:/04 - Media/Python Projects/4 - Networking/Send_Variable_Test/Server.py", line 33, in <module>
t1 = threading.Thread(target=socket)
AttributeError: 'module' object has no attribute 'Thread'
Exception AttributeError: "'module' object has no attribute '_shutdown'" in <module 'threading' from 'D:\04 - Media\Python Projects\4 - Networking\Send_Variable_Test\threading.pyc'> ignored
its obvious from this error that apparently there is no "Thread" module in the threading library, why is this? is the fact that I'm using python 2 the reason?
It looks like you have a file in your path that is called threading.py. Rename that and also delete the .pyc file and it should work.
In particular at this location: D:\04 - Media\Python Projects\4 - Networking\Send_Variable_Test\threading.pyc
Related
im trying to disable auto update in Circutpython 8.0 beta on the pico W and every time I run
import supervisor supervisor.disable_autoreload()
I always get this error
>>> supervisor.disable_autoreload() Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'disable_autoreload'
how can I fix this
I had the same issue and I'm not sure why because this function is still in the official documentation. Anyways, this worked for me on en_US-8.0.0-rc.2.
supervisor.runtime.autoreload = False
I'm data analysis using GoaTools, I installed all the sufficient packages, its shows error. Not able to figure it out. Help is needed.
Using Python 3.7.6
python plot_go_term.py --term=GO:0005737 --gml
go-basic.obo: fmt(1.2) rel(2020-06-01) 47,233 GO Terms
GO:0005737 level-02 depth-02 cytoplasm [cellular_component]
all parents: {'GO:0005575', 'GO:0110165'}
all children: {'GO:0016528', 'GO:0099631', 'GO:0106037', 'GO:0045495', 'GO:0060293', 'GO:0032838', 'GO:0120111', 'GO:0097575', 'GO:1902716', 'GO:0061846', 'GO:1990753', 'GO:1904115', 'GO:0099568', 'GO:0051285', 'GO:0097014', 'GO:0098831', 'GO:0032839', 'GO:0099738', 'GO:0045179', 'GO:0061803', 'GO:0061802', 'GO:0045180', 'GO:1990917', 'GO:0005938', 'GO:0031097', 'GO:0098834', 'GO:1904269'}
Traceback (most recent call last):
File "plot_go_term.py", line 59, in <module>
draw_children=opts.draw_children)
File "/home/cent/anaconda3/lib/python3.7/site-packages/goatools/obo_parser.py", line 594, in draw_lineage
obj = nx.from_agraph(grph) if engine == "pygraphviz" else nx.from_pydot(grph)
AttributeError: module 'networkx' has no attribute 'from_agraph'
The version of python is 2.7.13.
The content of 3.txt is:
this is a river
that is a cloud
the world is beatiful
I write a python script:
import fileinput
def process(string):
print 'Processing: ', string
for line in fileinput.input(r'E:\Python\3.txt'):
process(line)
When I run this script , it report error:
====================== RESTART: E:\Python\fileinput.py ======================
Traceback (most recent call last):
File "E:\Python\fileinput.py", line 1, in <module>
import fileinput
File "E:\Python\fileinput.py", line 7, in <module>
for line in fileinput.input(r'E:\Python\3.txt'):
AttributeError: 'module' object has no attribute 'input'
--------------------------------------------------------------------------------
What is the reason cause this problem ?
How can I slove this problem ?
Don’t name your script “fileinput.py”. It conflicts with the library module of the same name.
I have written the simplest python code (module) :
def newplus(x, y):
return x*y
This is stored in a folder sabya (which is my package). The folder has _init_ and newplus.py files.
In my IDLE I can open the module sabya.newplus. When I give import sabya.newplus there is no error. but when I issue :
>>> sabya.newplus(2, 3)
I am getting this error
Traceback (most recent call last):
File "<pyshell#15>", line 1, in <module>
sabya.newplus(2, 3)
TypeError: 'module' object is not callable
You need to qualify the function as follow:
sabya.newplus.newplus(2, 3)
When I copy the below code in Ideone then it runs fine but it is not running in the text editor and showing the error mentioned in the subject of this post:
import calendar
c = calendar.TextCalendar(calendar.SUNDAY)
c.prmonth(2007, 7)
The complete error is:
Traceback (most recent call last):
File "calendar.py", line 1, in <module>
import calendar
File "/home/shl/Desktop/calendar.py", line 2, in <module>
c = calendar.TextCalendar(calendar.SUNDAY)
AttributeError: 'module' object has no attribute 'TextCalendar'
change the program name from calendar.py to something like calendar_code.py
This wold work properly.
Importing from builtin library when module with same name exists