Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python 3 - no module named sockwrap #34

Open
anupamme opened this issue Oct 16, 2015 · 8 comments
Open

python 3 - no module named sockwrap #34

anupamme opened this issue Oct 16, 2015 · 8 comments

Comments

@anupamme
Copy link

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
Copy link
Owner

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

@FraBle
Copy link

FraBle commented Mar 28, 2016

+1

1 similar comment
@elliottash
Copy link

+1

@mauryquijada
Copy link

mauryquijada commented Jul 8, 2016

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

  • 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 and 348, add parentheses around the print function argument.

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

@shafy
Copy link

shafy commented Sep 13, 2017

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

@iamved
Copy link

iamved commented Mar 20, 2018

Thanks guys for corrections.

@sreenathelloti
Copy link

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
Copy link

Thanks, it worked for me too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants