Conway / perspective

An API wrapper for Google's Perspective API
MIT License
18 stars 9 forks source link

ImportError: cannot import name 'Perspective' #9

Closed amittos closed 3 years ago

amittos commented 6 years ago

Thank you for creating this wrapper.

I'm experiencing a weird problem. Even though the python package perspective is definitely installed on my system, when I'm running the script I get the following error:

ImportError: cannot import name 'Perspective'

Any ideas? I don't have this problem with any of my other packages.

sometimescool22 commented 5 years ago

Same here. Installed with pip3 install perspective.

kasavin commented 5 years ago

I'm seeing this as well. Tried changing the package install path but that didn't work.

annabananas8712 commented 5 years ago

When you pip install the package as stated in the directions, you are only downloading the perspective-0.1b0-py3.6.egg-info file with information on the package. The perspective file on this project contains all of the .py files for the module, of which you have to make the package folder on your own in dist-packages or site-packages in your python lib folder

darthnithin commented 4 years ago

so that means the docs should be updated

thrzl commented 3 years ago

why doesn't he just make __init__.py

edit: I see that the problem isn't a bad __init__.py, it is during the actual install. Perspective never actually installs, it just installs the information.

Thulium-Arun commented 3 years ago

Same This happenening with me I also found that there is not modulto import from there is only the information or text files as isigebengu-mikey said. Hope the Devs fix this quick as i am really looking forward to using this image_2021-02-19_120406 image

Thulium-Arun commented 3 years ago

Same This happenening with me I also found that there is not modulto import from there is only the information or text files as isigebengu-mikey said. Hope the Devs fix this quick as i am really looking forward to using this image_2021-02-19_120406 image

Well I found a wrok around, download the files from github. it works but the thing is that you will need to keep it in you rproject folder

HexyeDEV commented 3 years ago

How could i use the library? It doesn't work even after installation

Conway commented 3 years ago

These issues should be fixed in v1.0.3

https://pypi.org/project/perspective/1.0.3/

Sarayu99 commented 11 months ago

how can I print scores other than TOXICITY in v1.0.3? WHen I use the below code and print 'results' it is a dictionary with only one key - 'TOXICITY'

from perspective import PerspectiveAPI p = Perspective("API_KEY") result = p.score("This is a comment") print("Toxicity score: " + result["TOXICITY"])