I successfully installed JPype and Boilerpipe Python wrapper.
My JAVA_HOME path is correct (as far as I know).
I created a python file with the following code:
from boilerpipe.extract import Extractor
extractor = Extractor(extractor='ArticleExtractor', url='http://edition.cnn.com/2016/02/09/politics/new-hampshire-primary-highlights/')
extracted_text = extractor.getText()
print(extracted_text)
I am getting this error when I run python3 boiler_test.py
Traceback (most recent call last):
File "boiler_test.py", line 1, in <module>
from boilerpipe.extract import Extractor
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/boilerpipe/extract/__init__.py", line 2, in <module> import urllib2
ImportError: No module named 'urllib2'
How can I solve this?
Thank you.
Related
I am calling .py file from node.js using npm i cmd-node on windows it is working well and executing my .py file from .js file, but when I am deploying it on the server giving following error:
Note: I am not importing parse anywhere, it may be part if any dependency.
python script cmd error: Error: Command failed: python covert_to_csv.py
Traceback (most recent call last):
File "covert_to_csv.py", line 1, in <module>
import tabula
File "/home/ubuntu/.local/lib/python2.7/site-packages/tabula/__init__.py", line 3, in <module>
from .wrapper import (
File "/home/ubuntu/.local/lib/python2.7/site-packages/tabula/wrapper.py", line 20, in <module>
from .file_util import localize_file
File "/home/ubuntu/.local/lib/python2.7/site-packages/tabula/file_util.py", line 3, in <module>
from urllib.parse import urlparse as parse_url
ImportError: No module named parse
You are probably using different versions of python on your local machine compared to the server. Make sure it is the same version as your local machine and it'll work.
I downloaded the localization package in Anaconda. But when I try to import it I get the following error:
Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> import localization File "~\Python\Python36-32\lib\site-packages\localization\__init__.py", line 1, in <module>
from geoProject import *
ModuleNotFoundError: No module named 'geoProject'
I do not know what to do, can someone please help me out?
"geoProject", must be your project name, not the name of the module you are trying to input.
Try:
from your module import *
or just
import yourmodule
It works if your module is in current directory. Unless you should write the full path to your module
I am using Windows 7. I have installed Python 3.4 and Metmatplotlib.
I have tried the below code
from pylab import *
plot([1,2,3])
show()
But i am getting the follwoign error
Traceback (most recent call last):
File "E:/Work/Python/Training/Samples.py", line 1, in <module>
from pylab import *
File "C:\Python34\lib\site-packages\pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "C:\Python34\lib\site-packages\matplotlib\__init__.py", line 169, in <module>
from urllib2 import urlopen
ImportError: No module named 'urllib2'
I have searched for the package urllib2 but not seems to be find it.
Can any one help me
Thanks,
The urllib2 module has been split across several modules in Python 3 named urllib.request and urllib.error. The 2to3 tool will automatically adapt imports when converting your sources to Python 3.
https://docs.python.org/2/library/urllib2.html
When I run my .py file I am getting this error I have installed readability and lxml it was working before I don't know why it isn't working right no
13:08 ~ $ python3 hiiraanv2.py
Traceback (most recent call last):
File "hiiraanv2.py", line 6, in <module>
from readability import Document
ImportError: No module named 'readability'
In the readability module documentation, shows that class Document has to be imported from readability.readability.
Usage Example found in the documentation:
from readability.readability import Document
import urllib
html = urllib.urlopen(url).read()
readable_article = Document(html).summary()
readable_title = Document(html).short_title()
When I try to import multiprocessing in Python 2.7.5 on OS X 10.6.8, I get this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/__init__.py", line 65, in <module>
from multiprocessing.util import SUBDEBUG, SUBWARNING
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/util.py", line 40, in <module>
from subprocess import _args_from_interpreter_flags
ImportError: cannot import name _args_from_interpreter_flags
I also tried to install python2.7.6 with homebrew, but this error still occurs.
It sounds like a circular import issue. Try adding this to the the rest of your imports:
from subprocess import _args_from_interpreter_flags
There is a comment above the function in subprocess.py:
# XXX This function is only used by multiprocessing and the test suite,
# but it's here so that it can be imported when Python is compiled without
# threads.
May be related.