s-4-m-a-n / subscene-API

An unofficial version of python3 subscene API wrapper
MIT License
6 stars 0 forks source link

cannot import name 'Stylesheet' from 'bs4.element' #1

Closed ShowrMonstr closed 4 years ago

ShowrMonstr commented 4 years ago

Hey, Thanks for uploading this, I have trouble with the other unofficial APIs, I was hoping this one could help, but I have the following issue, when i execute from Jupyter :

import subsceneAPI from subsceneAPI import subtitle

ImportError: cannot import name 'Stylesheet' from 'bs4.element' (C:\Users[...]\anaconda3\lib\site-packages\bs4\element.py)

Could you help ?

Thanks !

s-4-m-a-n commented 4 years ago

Thanks for your valuable feedback. Let me check and get back to you.

On Tue, May 5, 2020, 7:25 PM ShowrMonstr notifications@github.com wrote:

Hey, Thanks for uploading this, I have trouble with the other unofficial APIs, I was hoping this one could help, but I have the following issue, when i execute from Jupyter :

import subsceneAPI from subsceneAPI import subtitle

ImportError: cannot import name 'Stylesheet' from 'bs4.element' (C:\Users\Hugo_Shadow\anaconda3\lib\site-packages\bs4\element.py)

Could you help ?

Thanks !

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/s-4-m-a-n/subscene-API/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJWJK4LLHBIQNWS4QIB74NTRQAJNZANCNFSM4MZSVCGA .

s-4-m-a-n commented 4 years ago

I'm not getting any problem at all here on jupyter notebook. May be you already have installed different version of bs4 on your system which is conflicting the requirements. The possible solutions may be:

  1. installing it into a new environment
  2. there was a minor mistake in the README. Instead of using "pip install subsceneAPI==0.1" , try "pip install subsceneAPI==0.2"
ShowrMonstr commented 4 years ago

I checked and I do have the right versions installed :

Requirement already satisfied: subsceneAPI in c:\users\\anaconda3\lib\site-packages (0.2) Requirement already satisfied: requests==2.23.0 in c:\users\\anaconda3\lib\site-packages (from subsceneAPI) (2.23.0) Requirement already satisfied: beautifulsoup4==4.9.0 in c:\users\\anaconda3\lib\site-packages (from subsceneAPI) (4.9.0) Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\\anaconda3\lib\site-packages (from requests==2.23.0->subsceneAPI) (1.25.8) Requirement already satisfied: certifi>=2017.4.17 in c:\users\\anaconda3\lib\site-packages (from requests==2.23.0->subsceneAPI) (2019.11.28) Requirement already satisfied: idna<3,>=2.5 in c:\users\\anaconda3\lib\site-packages (from requests==2.23.0->subsceneAPI) (2.8) Requirement already satisfied: chardet<4,>=3.0.2 in c:\users\\anaconda3\lib\site-packages (from requests==2.23.0->subsceneAPI) (3.0.4) Requirement already satisfied: soupsieve>1.2 in c:\users\\anaconda3\lib\site-packages (from beautifulsoup4==4.9.0->subsceneAPI) (1.9.5)

I can try the new environment even if that's not really convenient.

Does the error means I'm missing a file or something like that ?

s-4-m-a-n commented 4 years ago

Why don't you try CLI usage ? If you are still getting error, please send the screenshot.

s-4-m-a-n commented 4 years ago

Why don't you try CLI usage ? If you are still getting error, please send the screenshot.

ShowrMonstr commented 4 years ago

CLI does work, which is nice ! But i need to integrate your API to a python script that I have, so having it worked on Jupyter would be ideal really.

Here's a screenshot : image

s-4-m-a-n commented 4 years ago

Sometime we get this weird error on file name conflict. Is it is possible to sent me the screenshot of director folder. Or you can do it by yourself, just rename the file (.ipynb) and other file of the same folder.

On Tue, May 5, 2020, 9:28 PM ShowrMonstr notifications@github.com wrote:

CLI does work, which is nice ! But i need to integrate your API to a python script that I have, so having it worked on Jupyter would be ideal really.

Here's a screenshot : [image: image] https://user-images.githubusercontent.com/64846704/81085701-da5fd000-8ef7-11ea-9833-508251f73c4e.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/s-4-m-a-n/subscene-API/issues/1#issuecomment-624133325, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJWJK4NFCM6ZRFOQX3ZSRGTRQAX2TANCNFSM4MZSVCGA .

ShowrMonstr commented 4 years ago

Just did it, here's a screenshot : image

This gets me another error message : image

Did i do what you said correctly ?

s-4-m-a-n commented 4 years ago

Change the main folder's name bs4 into whatever you want but not bs4.

ShowrMonstr commented 4 years ago

Did it, same error :

image

s-4-m-a-n commented 4 years ago

resend me a screenshot of the directory. And run the code "from bs4 import Beautifulsoup" saperately.

On Tue, May 5, 2020, 9:57 PM ShowrMonstr notifications@github.com wrote:

Did it, same error :

[image: image] https://user-images.githubusercontent.com/64846704/81088896-ebaadb80-8efb-11ea-98b0-67fcdbe3eb77.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/s-4-m-a-n/subscene-API/issues/1#issuecomment-624149795, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJWJK4LERDJQ4HMENP3WILTRQA3GVANCNFSM4MZSVCGA .

ShowrMonstr commented 4 years ago

Here's the new directory : C:\Users...\anaconda3\Lib\site-packages\bs4_2

image

ShowrMonstr commented 4 years ago

If I run this : from bs4_2 import Beautifulsoup

Still the same error occurs :

image

(Thanks for your help btw)

s-4-m-a-n commented 4 years ago

No man you cannot import Beautifulsoup from bs4_2 .... you have to import it from bs4 ..... and why don't you restart anaconda and jupyter notebook.

On Tue, May 5, 2020, 10:21 PM ShowrMonstr notifications@github.com wrote:

If I run this : from bs4_2 import Beautifulsoup

Still the same error occurs :

[image: image] https://user-images.githubusercontent.com/64846704/81091257-4134b780-8eff-11ea-8b82-3d8e5b5138b1.png

(Thanks for your help btw)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/s-4-m-a-n/subscene-API/issues/1#issuecomment-624163048, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJWJK4I5IUHA32YM2GUHIHTRQA6ANANCNFSM4MZSVCGA .

ShowrMonstr commented 4 years ago

Sorry this is a bit confusing :/ I restared everything. The folder is still renamed bs4_2. from bs4 import Beautifulsoup still gets me the same error : ModuleNotFoundError: No module named 'bs4'

s-4-m-a-n commented 4 years ago

Try to reinstall subsceneAPI, may be because of the previous issue bs4 is not properly installed.

On Tue, May 5, 2020, 10:36 PM ShowrMonstr notifications@github.com wrote:

Sorry this is a bit confusing :/ I restared everything. The folder is still renamed bs4_2. from bs4 import Beautifulsoup still gets me the same error : ModuleNotFoundError: No module named 'bs4'

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/s-4-m-a-n/subscene-API/issues/1#issuecomment-624172706, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJWJK4L35P5BLQXUVTNUJTLRQA7ZRANCNFSM4MZSVCGA .

ShowrMonstr commented 4 years ago

It worked ! Seems like uninstalling everything, erasing the bs4 file from the site-packages/ folder and then reinstall subsceneAPI did the trick.

Thanks a lot for your help !