mustafadalga / Instagram-Bot

An Instagram bot developed using the Selenium Framework
https://github.com/mustafadalga/Instagram-Bot
GNU General Public License v3.0
280 stars 84 forks source link

Error when launching the bot #22

Closed AkrA0n closed 3 years ago

AkrA0n commented 3 years ago

Hi, thanks for the bot. I however ran into some issues on windows:

python -m pip install -r .\requirements.txt -->

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
requests 2.22.0 requires urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1, but you have urllib3 1.26.2 which is incompatible.
Successfully installed urllib3-1.26.2

And then, when launching the bot:

C:\Users\xxx\Desktop\C19TEST\Instagram-Bot-master>python instagram.py
Traceback (most recent call last):
  File "C:\Users\xxx\Desktop\bot\Instagram-Bot-master\instagram.py", line 2031, in <module>
    instagram = Instagram()
  File "C:\Users\xxx\Desktop\bot\Instagram-Bot-master\instagram.py", line 21, in __init__
    self.ayarlarYukle()
  File "C:\Users\xxx\Desktop\bot\Instagram-Bot-master\instagram.py", line 1040, in ayarlarYukle
    self.config = json.load(dosya)
  File "C:\Users\xxx\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
  File "C:\Users\xxx\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\xxx\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\xxx\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Invalid \escape: line 3 column 23 (char 87)
anandxkumar commented 3 years ago

Try the following Code :

pip install requests --upgrade

If error still persists then try the following code :

pip uninstall urllib3 pip install urllib3==1.22

rockcover123 commented 3 years ago

I get the same error, tried updating requests and reinstalling urllib3 but didn't work.

I'm running on Windows 10 with Python 3.9.

@mustafadalga any suggestion? Thanks

mustafadalga commented 3 years ago

Try run with Powershell

rockcover123 commented 3 years ago

Try run with Powershell

Thanks for the input, but unfortunately it didn't solve. I tried running the script on another PC with Python 3.8 and still got the error.

mustafadalga commented 3 years ago

There is a warning and an error above. Which one did you encounter? The following error may be related to the Turkish character problem.

json.decoder.JSONDecodeError: Invalid \escape: line 3 column 23 (char 87)

There may be a problem with the name you used in the xxx folder path. C:\Users\xxx\Desktop\C19TEST\Instagram-Bot-master

For example, try the application in the C: \ directory. As follows C:\Instagram-Bot-master

rockcover123 commented 3 years ago

There is a warning and an error above. Which one did you encounter? The following error may be related to the Turkish character problem.

json.decoder.JSONDecodeError: Invalid \escape: line 3 column 23 (char 87)

There may be a problem with the name you used in the xxx folder path. C:\Users\xxx\Desktop\C19TEST\Instagram-Bot-master

For example, try the application in the C: \ directory. As follows C:\Instagram-Bot-master

Sorry if I haven't been that clear: I'm only encountering the error, there isn't any warning appearing when installing the requirements.

Here's a transcript of the error:

Traceback (most recent call last):
  File "C:\Instagram-Bot-master\instagram.py", line 2033, in <module>
    instagram = Instagram()
  File "C:\Instagram-Bot-master\instagram.py", line 23, in __init__
    self.ayarlarYukle()
  File "C:\Instagram-Bot-master\instagram.py", line 1042, in ayarlarYukle
    self.config = json.load(dosya)
  File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
  File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Invalid \escape: line 3 column 23 (char 87)

As you can see, I've placed the script folder in C:\ but the same error is occuring

mustafadalga commented 3 years ago

I tried using powershell and cmd in Windows operating system, terminal in Linux operating system and did not encounter any errors.

The error of the problem may be the Turkish character problem, but I cannot test it, because I cannot see an error.

Can you change the character encoding of your terminal to utf-8 and try it? https://ss64.com/nt/chcp.html

rockcover123 commented 3 years ago

I've managed to fix it by using double \ in the config file. So if I had C:\User\folder\geckodriver.exe it now is C:\\User\\folder\\geckodriver.exe. Thanks for the input.

mustafadalga commented 3 years ago

I did not notice the driver path change! The default path also has double /. https://github.com/mustafadalga/Instagram-Bot/blob/e6aa6d1672a3d6b5f78ea995c8d91221d51cc215/config.json#L3 You're welcome :)