I am trying "whois" with python.
I installed whois for python using following code (OS:- CentOS 7)
pip install python-whois
when I run following three commands at python console it works
import whois
w = whois.whois('www.google.com')
print w
But when same three lines I save in file whois.py and run code with command
python whois.py
It gives following error
Traceback (most recent call last):
File "whois.py", line 1, in <module>
import whois
File "/home/sysadmin/pythonPractice/whois.py", line 2, in <module>
w = whois.whois('www.google.com')
TypeError: 'module' object is not callable
this issue is because your filename is whois.py and when you try to call the library whois it gets overwritten so, you should name your file from whois.py to something else.
Related
I've installed igraph on Python 3.7.2 using the wheel at https://www.lfd.uci.edu/~gohlke/pythonlibs/#python-igraph and 'pip install python-igraph'. I attempted to create a simple graph with:
import igraph
g = igraph.Graph()
This works when I run it in the console (IDLE) but when I write it in a script and execute it, the second command gives the following error:
Traceback (most recent call last):
File "path\igraph.py", line 1, in <module>
import igraph
File "path\igraph.py", line 3, in <module>
g = igraph.Graph()
AttributeError: module 'igraph' has no attribute 'Graph'
Previously I wrongly used 'pip install igraph" but later uninstalled it.
Most likely, you named your executable file igraph.py, so there is a name conflict. Just rename the file
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'm having issues running ortools on Linux. I downloaded it from google's site (https://developers.google.com/optimization/) and installed it using "make install," but when I go to use it in python I get the following:
Traceback (most recent call last):
File "regular.py", line 42, in <module>
from ortools.constraint_solver import pywrapcp
File "/home/m3/summer/ortools_examples/examples/python/ortools.py", line 2, in <module>
ImportError: No module named linear_solver
It looks like despite installing ortools, its still not in my python path correctly, so when I call it in the file, it doesn't find anything and returns an error, right? Any advice on how to solve this?
I recently set up Cuckoo environment on Arch Linux host with WXPSP3 guest.
When I try to upload file for analysis using submit.py I get the following error:
Traceback (most recent call last):
File "./utils/submit.py", line 23, in <module>
from lib.cuckoo.common.utils import to_unicode
File "/opt/cuckoo/utils/../lib/cuckoo/common/utils.py", line 11, in <module>
import xmlrpclib
ImportError: No module named 'xmlrpclib'
I run out of ideas. Could you help?
J
It works if I run python via python2.7 command so:
# python2.7 ./utils/submit.py <filepath>
I'm trying to run Caffe in it's Python interface. I've already run the command make pycaffe in the caffe directory and it worked fine. Now, when I run the command import caffe in the python environment in the terminal (Ubuntu 14.04), I'm getting the following error:
>>> import caffe
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pras/caffe/python/caffe/__init__.py", line 1, in <module>
from .pycaffe import Net, SGDSolver
File "/home/pras/caffe/python/caffe/pycaffe.py", line 11, in <module>
import caffe.io
ImportError: No module named io
I tried to search my computer for 'caffe.io' but couldn't find any file by that name. Any idea why this error is occurring and how to correct it?
You need to add Python Caffe to PYTHONPATH. In your case:
export PYTHONPATH=$PYTHONPATH:/home/pras/caffe/python