GramAddict / bot

Completely free and open-source human-like Instagram bot. Powered by UIAutomator2 and compatible with basically any Android device 5.0+ that can run Instagram - real or emulated.
https://docs.gramaddict.org
MIT License
1.13k stars 179 forks source link

Bot won't work: No module named 'colorama' #354

Closed tiritibambix closed 10 months ago

tiritibambix commented 10 months ago

What happened: Bot won't launch, got error messages

What you expected to happen: Bot should launch

How to reproduce it (as minimally and precisely as possible): Follow tutorial https://youtu.be/POa5UPDYT3A?feature=shared

Anything else we need to know?:

import os platformToolsFolder = r"D:\Programmes\GramAddict\platform-tools" os.environment["PATH"] += os.pathsep + os.pathsep.join([platformToolsFolder +""])

GramAddict.run()

- cmd in `D:\Programmes\GramAddict` and run python `run.py --config D:\Programmes\GramAddict\directioncat\config.yml`
- See error messages bellow in `Relevant Logs`

**Environment**:
- GramAddict version: as of 2024/01/07
- Device Model/Emulator Type: Redmi Note 4
- Android Version: MIUI Global 10.2
- Instagram Version: 278.0.0.22.117
- Discord Ticket ID:           *(if submitting crash log)

Relevant Logs:

D:\Programmes\GramAddict>python run.py --config D:\Programmes\GramAddict\directioncat\config.yml Traceback (most recent call last): File "D:\Programmes\GramAddict\run.py", line 1, in import GramAddict File "D:\Programmes\GramAddict\GramAddict__init__.py", line 5, in from GramAddict.core.bot_flow import start_bot File "D:\Programmes\GramAddict\GramAddict\core\bot_flow.py", line 6, in from colorama import Fore, Style ModuleNotFoundError: No module named 'colorama'

herodotos commented 10 months ago

It looks like you missing colorama module, did you install all modules from requirements file? "pip install -r requirements.txt" there is colorama mention, so it should install it. But I am not sure this is the problem.

tiritibambix commented 10 months ago

Oh yes, thank you. I missed some requirements. I've been installing some that were missing, and now it asks for pkg_resources, which is not listed in the requirements. Which version should I install ? pkgressources.jpg

Edit: I installed setuptools-69.0.3

tiritibambix commented 10 months ago

Now I have this error :

Traceback (most recent call last):
  File "D:\Programmes\GramAddict\run.py", line 5, in <module>
    os.environment["PATH"] += os.pathsep + os.pathsep.join([platformToolsFolder +""])
    ^^^^^^^^^^^^^^
AttributeError: module 'os' has no attribute 'environment'

Is this a typo in run.py ?

Edit: it is os.environ and not os.environment

tiritibambix commented 10 months ago

Ok, making some pregress, but I have another buf

here is the full log

ERROR | Exception: -32001 Jsonrpc error: <java.lang.SecurityException> data: java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission
        at android.os.Parcel.createExceptionOrNull(Parcel.java:2376)
        at android.os.Parcel.createException(Parcel.java:2360)
        at android.os.Parcel.readException(Parcel.java:2343)
        at android.os.Parcel.readException(Parcel.java:2285)
        at android.app.IUiAutomationConnection$Stub$Proxy.injectInputEvent(IUiAutomationConnection.java:471)
        at android.app.UiAutomation.injectInputEvent(UiAutomation.java:628)
        at com.github.uiautomator.stub.TouchController.injectEventSync(TouchController.java:38)
        at com.github.uiautomator.stub.TouchController.touchDown(TouchController.java:47)
        at com.github.uiautomator.stub.AutomatorServiceImpl.click(AutomatorServiceImpl.java:206)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.googlecode.jsonrpc4j.JsonRpcBasicServer.invoke(JsonRpcBasicServer.java:467)
        at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleObject(JsonRpcBasicServer.java:352)
        at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleJsonNodeRequest(JsonRpcBasicServer.java:283)
        at com.googlecode.jsonrpc4j.JsonRpcBasicServer.handleRequest(JsonRpcBasicServer.java:251)
        at com.github.uiautomator.stub.AutomatorHttpServer.serve(AutomatorHttpServer.java:100)
        at fi.iki.elonen.NanoHTTPD.serve(NanoHTTPD.java:2244)
        at fi.iki.elonen.NanoHTTPD$HTTPSession.execute(NanoHTTPD.java:945)
        at fi.iki.elonen.NanoHTTPD$ClientHandler.run(NanoHTTPD.java:192)
        at java.lang.Thread.run(Thread.java:923)
, method: click

I have no clue what I am reading :(

Edit: after trying again, I got another type of error:

D:\Programmes\GramAddict>python run.py --config D:\Programmes\GramAddict\instagramuser\config.yml
[01/07 21:44:54]     INFO | Checking for updates...
[01/07 21:44:55]     INFO | Bot is updated.
[01/07 21:44:55]     INFO | GramAddict v.3.2.7
[01/07 21:44:55]     INFO | Loading plugins . . .
[01/07 21:44:55]     INFO |   - ActionUnfollowFollowers: Handles the functionality of unfollowing your followers
[01/07 21:44:55]     INFO |   - ClonedApp: Adds support for cloned apps
[01/07 21:44:55]     INFO |   - CoreArguments: Simply adds core arguments
[01/07 21:44:55]     INFO |   - DataAnalytics: Generates a PDF analytics report of current username session data
[01/07 21:44:55]     INFO |   - InteractBloggerPostLikers: Handles the functionality of interacting with a blogger
[01/07 21:44:55]     INFO |   - InteractBloggerFollowers_Following: Handles the functionality of interacting with a bloggers followers/following
[01/07 21:44:55]     INFO |   - InteractBloggerPostLikers: Handles the functionality of interacting with a blogger post likers
[01/07 21:44:55]     INFO |   - InteractOwnFeed: Handles the functionality of interacting with your own feed
[01/07 21:44:55]     INFO |   - InteractHashtagLikers: Handles the functionality of interacting with a hashtags likers
[01/07 21:44:55]     INFO |   - InteractHashtagPosts: Handles the functionality of interacting with a hashtags post owners
[01/07 21:44:55]     INFO |   - InteractPlaceLikers: Handles the functionality of interacting with a places likers
[01/07 21:44:55]     INFO |   - InteractPlacePosts: Handles the functionality of interacting with a places post owners
[01/07 21:44:55]     INFO |   - LikeFromURLs: Likes a post from url. The urls are read from a plaintext file
[01/07 21:44:55]     INFO |   - RemoveFollowersFromList: Remove account followers from a list of usernames
[01/07 21:44:55]  WARNING | If you want to use telegram_reports, please type in console: 'pip3 install gramaddict[telegram-reports]'
[01/07 21:44:55]     INFO |   - TelegramReports: Generate reports at the end of the session and send them using telegram
[01/07 21:44:55]     INFO | Time delta has set to 00:00:12.
[W 240107 21:44:55 __init__:218] [pid:1516] atx-agent has something wrong, auto recovering
[D 240107 21:44:55 __init__:317] [pid:1516] [c45b3e95] device c45b3e95 is online
[I 240107 21:44:56 init:156] uiautomator2 version: 2.16.25
[D 240107 21:44:56 init:167] Shell: ('/data/local/tmp/atx-agent', 'server', '--stop')
[D 240107 21:44:56 init:295] Real version: [0, 10, 0], Expect version: [0, 10, 0]
[D 240107 21:44:56 init:167] Shell: ('/data/local/tmp/atx-agent', 'server', '--nouia', '-d', '--addr', '127.0.0.1:7912')
[I 240107 21:44:56 init:350] Check atx-agent version
[D 240107 21:44:56 init:359] Forward: local:tcp:18695 -> remote:tcp:7912
[D 240107 21:44:57 init:359] Forward: local:tcp:18695 -> remote:tcp:7912
[D 240107 21:44:57 init:362] atx-agent version 0.10.0
[D 240107 21:44:57 init:366] device wlan ip: 192.168.1.114
[D 240107 21:44:57 __init__:661] [pid:1516] [c45b3e95] kill process(ps): uiautomator
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\uiautomator2\__init__.py", line 486, in _jsonrpc_retry_call
    return self._jsonrpc_call(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\uiautomator2\__init__.py", line 519, in _jsonrpc_call
    raise GatewayError(
uiautomator2.exceptions.GatewayError: (<Response [502]>, 'gateway error, time used 1.5s')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Programmes\GramAddict\run.py", line 7, in <module>
    GramAddict.run()
  File "D:\Programmes\GramAddict\GramAddict\__init__.py", line 9, in run
    start_bot(**kwargs)
  File "D:\Programmes\GramAddict\GramAddict\core\bot_flow.py", line 122, in start_bot
    get_device_info(device)
  File "D:\Programmes\GramAddict\GramAddict\core\device_facade.py", line 30, in get_device_info
    f"Phone Name: {device.get_info()['productName']}, SDK Version: {device.get_info()['sdkInt']}"
                   ^^^^^^^^^^^^^^^^^
  File "D:\Programmes\GramAddict\GramAddict\core\device_facade.py", line 314, in get_info
    return self.deviceV2.info
           ^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\uiautomator2\__init__.py", line 448, in info
    return self.jsonrpc.deviceInfo(http_timeout=10)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\uiautomator2\__init__.py", line 479, in __call__
    return self.server._jsonrpc_retry_call(self.method, params,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\uiautomator2\__init__.py", line 488, in _jsonrpc_retry_call
    self.reset_uiautomator(str(e))  # uiautomator可能出问题了,强制重启一下
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\uiautomator2\__init__.py", line 640, in reset_uiautomator
    ok = self._force_reset_uiautomator_v2(
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\uiautomator2\__init__.py", line 667, in _force_reset_uiautomator_v2
    if self._is_apk_required():
       ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\uiautomator2\__init__.py", line 711, in _is_apk_required
    if self._package_version("com.github.uiautomator.test") is None:
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\uiautomator2\__init__.py", line 735, in _package_version
    return packaging.version.parse(m.group('name') if m else "")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\packaging\version.py", line 54, in parse
    return Version(version)
           ^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\packaging\version.py", line 200, in __init__
    raise InvalidVersion(f"Invalid version: '{version}'")
packaging.version.InvalidVersion: Invalid version: ''
herodotos commented 10 months ago

You write a lot of messages, but if I read it right last wrote that you get response 502 from server, so check if server works, or if you call the right one.

tiritibambix commented 10 months ago

I had to uninstall then reinstall UIAutomator. Now it works.

It might be worth noting that it is required for Xiaomi phones to log into mi account to enable usb installing.

Now I need to tinker my config, but it seems it is working. Thank you very much :)

tiritibambix commented 10 months ago

Hello again. Sorry for posting here again, but I didn't want to open another issue and flood unnecessarily.

I wanted to try new arguments given here

skip_if_private: true
biography_language: [fr]

It doesn't seem to work: ERROR | Unknown arguments: --skip_if_private=true

Are they not supported anymore ?

Edit: oh ok, it was in filters.yml ...