fabianvf / python-rake

MIT License
130 stars 35 forks source link

Imports broken in python3 #17

Closed fabianvf closed 7 years ago

fabianvf commented 7 years ago

As per discussion in #9, the code

import RAKE

RAKE.SmartStopList()

works in python 2 but not in python3

@justinkterry working on it, forgot the import system changed so much, didn't think to look there. My fault.

jkterry1 commented 7 years ago

Still doesn't work:

justin@Justin:~/Documents$ sudo pip3 install python-rake -U
The directory '/home/justin/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/justin/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting python-rake
  Downloading python-rake-1.1.2.tar.gz
Installing collected packages: python-rake
  Found existing installation: python-rake 1.1.1
    Uninstalling python-rake-1.1.1:
      Successfully uninstalled python-rake-1.1.1
  Running setup.py install for python-rake ... done
Successfully installed python-rake-1.1.2
justin@Justin:~/Documents$ ipython
Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
Type 'copyright', 'credits' or 'license' for more information
IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import RAKE

In [2]: RAKE.SmartStopList()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-82f4c6d727de> in <module>()
----> 1 RAKE.SmartStopList()

AttributeError: module 'RAKE' has no attribute 'SmartStopList'

In [3]: RAKE.smart_stop_list()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-7195b3b7f0a5> in <module>()
----> 1 RAKE.smart_stop_list()

AttributeError: module 'RAKE' has no attribute 'smart_stop_list'

In [4]: quit()
fabianvf commented 7 years ago

Oh woops, guess it closed automatically when I merged the PR. I refactored it like you asked, so it's back to the SmartStopList, FoxStopList naming...

I'm really stumped here, it's working for me in python2 and python3

jkterry1 commented 7 years ago

Thanks for refactoring it

On Aug 1, 2017 2:12 PM, "Fabian von Feilitzsch" notifications@github.com wrote:

Reopened #17 https://github.com/fabianvf/python-rake/issues/17.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fabianvf/python-rake/issues/17#event-1188165775, or mute the thread https://github.com/notifications/unsubscribe-auth/AShd7BlPV3G1c4KowUzyUdrlHAuqndg4ks5sT2qFgaJpZM4Oi-Ip .

fabianvf commented 7 years ago

I've tested it in python 2.7 and python 3.5, with ipython + regular python, in and out of virtual environments, and I can't replicate this failure. Can you give me the output of

import RAKE

dir(RAKE)

Really want to get to the bottom of this, this behavior doesn't make sense to me.

jkterry1 commented 7 years ago

Uninstalling and reinstalling via pip fixed it. It looks like something broke creatively during the pip upgrade; I have no idea what but it affected multiple computers for me and my coworkers. I don't know if you might want to but a small note in the readme about the bad upgrade or if I should message pip or what.

jkterry1 commented 7 years ago

Can you close it? it won't let me.

fabianvf commented 7 years ago

Oh awesome! Thanks for the update, glad to know it's working. Was starting to feel crazy.

borodache commented 5 years ago

Hi, I have the same problem with PyCharm. I don't have this issue on Jupyter Notebook. uninstall and install didn't do any help.

for this code:

import RAKE

print(dir(RAKE))

The output is:

['RAKE', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__']
['RAKE', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__']

Best, Eli

jkterry1 commented 5 years ago

Are you certain you're using the most recent version of this package in your pycharm environment?

On Tue, May 28, 2019 at 5:09 AM borodache notifications@github.com wrote:

Hi, I have the same problem with PyCharm. I don't have this issue on Jupyter Notebook. uninstall and install didn't do any help.

for this code:

import RAKE

print(dir(RAKE))

The output is:

['RAKE', 'builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'spec'] ['RAKE', 'builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'spec']

Best, Eli

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fabianvf/python-rake/issues/17?email_source=notifications&email_token=AEUF33DNBU3BE6QUADYCRGDPXTZEXA5CNFSM4DUL4IU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWLPJOY#issuecomment-496432315, or mute the thread https://github.com/notifications/unsubscribe-auth/AEUF33HU3JJEXAJEPJ7FPPDPXTZEXANCNFSM4DUL4IUQ .

-- Thank you for your time, Justin Terry

borodache commented 5 years ago

python-rake is version 1.4.5

jkterry1 commented 5 years ago

What's the specifics of your pycharm environment?

On Thu, Jun 6, 2019 at 4:41 AM borodache notifications@github.com wrote:

python-rake is version 1.4.5

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fabianvf/python-rake/issues/17?email_source=notifications&email_token=AEUF33DKT4DVZPKLPVP5NQDPZDES5A5CNFSM4DUL4IU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXCE5CA#issuecomment-499404424, or mute the thread https://github.com/notifications/unsubscribe-auth/AEUF33G3LXVCG7GLY3HAZNTPZDES5ANCNFSM4DUL4IUQ .

-- Thank you for your time, Justin Terry

borodache commented 5 years ago

Hi, I am not sure what you meant by specifics, but when I looked into the about of the PyCharm I got this information:

PyCharm 2018.3.5 Build #PC-183.5912.18, built on February 26, 2019

JRE: 1.8.0_152-release-1343-b28 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

borodache commented 5 years ago

An update: it must be something stupid with configuration when I open the same file from other project and run it, I get the same out print, but I can press ctrl + click and get inside the Rake library.

borodache commented 5 years ago

Any idea?

jkterry1 commented 5 years ago

It's clearly very specific to pycharm. I don't use the IDE and have no idea what the problem there is. You really should update to the newest version of PyCharm though.

On Tue, Jun 18, 2019 at 7:57 AM borodache notifications@github.com wrote:

Any idea?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fabianvf/python-rake/issues/17?email_source=notifications&email_token=AEUF33D2IRJW2PCPN4NTOZDP3DESTA5CNFSM4DUL4IU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODX6EMLA#issuecomment-503072300, or mute the thread https://github.com/notifications/unsubscribe-auth/AEUF33ACZR5VSMSISR6UDUDP3DESTANCNFSM4DUL4IUQ .

-- Thank you for your time, Justin Terry