Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

TypeError: 'type' object is not subscriptable #14

Closed
MRcode2102 opened this issue Jul 30, 2021 · 6 comments
Closed

TypeError: 'type' object is not subscriptable #14

MRcode2102 opened this issue Jul 30, 2021 · 6 comments
Assignees
Labels
question Further information is requested

Comments

@MRcode2102
Copy link

Hi Mr
I want to run the WaWebSession.py but while I run this script, show me this error
Traceback (most recent call last): File "/home/majid/Desktop/whatsapp/WaWebSessionHandler/WaWebSession.py", line 25, in <module> class SessionHandler: File "/home/majid/Desktop/whatsapp/WaWebSessionHandler/WaWebSession.py", line 30, in SessionHandler __browser_profile_list: list[str] TypeError: 'type' object is not subscriptable

I run this script with python 3 and also I downloaded and pasted the chromedriver in PATH
but doesn't work for me
can you help me please Mr?

@TSRBerry TSRBerry self-assigned this Jul 30, 2021
@TSRBerry
Copy link

Hello,
of course I will try to help you with this issue. At the moment I am not able to reproduce the issue, so this will be though to investigate.
This error message should tell me that I am interacting with a type object in a bad way (I know this is not an accurate explanation but I don't know how to word it better). But the issue seems to be about type hints and that leads me to a few questions:

What python version are you using? You can type python --version and paste the result here. I just looked at the docs for type
hints and I think that any version below 3.5 might not be working as expected. So if that's the case you might want to update to a newer python version like "3.8" or "3.9".
One more question to sanity check. Are you using the script that is currently in master? Have you cloned my repo or did you download a release version (because these are pretty old and don't really work that well)?

@TSRBerry TSRBerry added the question Further information is requested label Jul 30, 2021
@TSRBerry
Copy link

TSRBerry commented Sep 4, 2021

That's odd.
Why doesn't it like that I describe the type of my variables? That works perfectly fine for me.

I will look into this again in a few days. I am quite busy at the moment, so I am unable to work on it right away.

@TSRBerry
Copy link

TSRBerry commented Sep 4, 2021

Nevermind! I had some time today and found out why I wasn't able to reproduce the issue.

If you take a look at this issue you will see a very similar problem to this case. So I was testing my script on my raspberry pi today and got the same exception because I am using python 3.8, but on my pc I am using 3.9 which allows these type annotations.

So if you want to get it working quickly you should try to run it again with python 3.9.
I will work on making it compatible with python 3.8 and push these changes when I am ready.

Sorry to keep you waiting for so long (for such a simple issue).

@TSRBerry
Copy link

TSRBerry commented Sep 4, 2021

Could you try and test the script from "python38-compatibility" branch?

I am pretty sure that fixes the issue, but can't test it right now, so I would like to get your feedback on that, before I merge and close this.

@TSRBerry
Copy link

I had time to test this today and didn't have any issues.
Since I got no other feedback, I will merge this now and close this issue.

If anything is not working correctly on python 3.8 and you still experience some issues, feel free to reopen this issue.

TSRBerry pushed a commit that referenced this issue Sep 12, 2021
Add type annotations for python3.8 | Fixes: #14
@jeliebig jeliebig assigned jeliebig and unassigned TSRBerry Jul 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants
@TSRBerry @MRcode2102 @jeliebig and others