brendano / stanford_corenlp_pywrapper

151 stars 62 forks source link

python 3 - no module named sockwrap #34

Open anupamme opened 8 years ago

anupamme commented 8 years ago

I am running this with python 3.4 and after installing when I run following command

from stanford_corenlp_pywrapper import CoreNLP

I get an error

File "/Volumes/anupam_work/test/stanford_corenlp_pywrapper/stanford_corenlp_pywrapper/init.py", line 1, in from sockwrap import * ImportError: No module named 'sockwrap'

So how can this be resolved?

brendano commented 8 years ago

it might be relative imports? i've only tested this with 2.7. i seem to recall python 3 changed that stuff somehow.

FraBle commented 8 years ago

+1

elliottash commented 8 years ago

+1

mauryquijada commented 8 years ago

In order to import the code using with Python 3, I had to make a couple of changes:

I did some preliminary checking, and more changes may be needed to get the entire module working.

shafy commented 6 years ago

@mauryquijada thanks! There is also a print parenthesis missing in line 352

iamved commented 6 years ago

Thanks guys for corrections.

sreenathelloti commented 6 years ago

Line 1 of init.py, change "from sockwrap import " to "from .sockwrap import " Line 194 of sockwrap.py, change "except socket.error, e" to "except socket.error as e" Line 254 of sockwrap.py, change "except socket.timeout, e" to "except socket.timeout as e" Lines 332, 348 and 352 add parentheses around the print function argument

ekegulskiy commented 5 years ago

Thanks, it worked for me too.