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

unexpected keyword argument 'capture_output' on startup #92

Closed jlntrt closed 3 years ago

jlntrt commented 3 years ago

Hey. First of all: many thanks for the effort to keep software free and open source :heart:

In contrast to insomniac I have an issue on startup the app and I can't find the point to fix it:

(.venv) ➜  bot git:(master) python3 run.py --blogger-followers kwerfeldein --device ce01171159e094490c
[11/22 15:33:06]     INFO | GramAddict 1.0.4
[11/22 15:33:06]     INFO | Loading plugins . . .
[11/22 15:33:06]     INFO |   - ActionUnfollowFollowers: This plugin handles the functionality of unfollowing your followers
[11/22 15:33:06]     INFO |   - CoreArguments: This plugin simply adds core arguments
[11/22 15:33:08]     INFO |   - DataAnalytics: Generates a PDF analytics report of specified username session data
[11/22 15:33:08]     INFO |   - InteractBloggerFollowers: This plugin handles the functionality of interacting with a bloggers followers
[11/22 15:33:08]     INFO |   - InteractHashtagLikers: This plugin handles the functionality of interacting with a bloggers followers
[11/22 15:33:08]     INFO | Instagram version: not found
[11/22 15:33:08]     INFO | -------- START: 2020-11-22 15:33:08.220735 --------
[11/22 15:33:08]     INFO | Open Instagram app
Traceback (most recent call last):
  File "run.py", line 3, in <module>
    GramAddict.run()
  File "/home/julian/d/bot/GramAddict/__init__.py", line 154, in run
    open_instagram(device_id)
  File "/home/julian/d/bot/GramAddict/core/utils.py", line 80, in open_instagram
    cmd_res = subprocess.run(cmd, capture_output=True, shell=True, encoding="utf8")
  File "/usr/lib/python3.6/subprocess.py", line 423, in run
    with Popen(*popenargs, **kwargs) as process:
TypeError: __init__() got an unexpected keyword argument 'capture_output'

When I list the connected devices, it shows me my phone

(.venv) ➜  bot git:(master) adb devices                                                               
List of devices attached
ce01171159e094490c  device

The screen is active when I start the script. The dependencies are installed.

Can anyone give me a hint how to solve it?

philip-ulrich commented 3 years ago

Not gonna name any names, but it looks like someone snuck in a python 3.7 exclusive feature without bumping the python version requirement of the project (https://github.com/GramAddict/bot/blame/db9099093a5b82208e5ae1291adaabbe99ec6451/GramAddict/core/utils.py#L66). Part of the issue may have been that we were using pipenv to install 3.8 in the past, before we found out that was a bad idea. But realistically, we should be supporting 3.6 anyway.

So there’s a couple ways to resolve this:

  1. You could update to python 3.7 or later. It looks like you are running Linux so that shouldn’t be too hard. It’s also not really a bad idea either.
  2. We can work with you to adjust the code and test 3.6 compatibility. We’ll likely need to adjust a few lines so will probably have to send you a new file for testing.

If you want to do # 2 or if you need help with # 1, go ahead and join our discord server and open up a ticket. We’ll make sure you get set up. 😄

Sorry for the problem!

jlntrt commented 3 years ago

Hey @philip-ulrich thank you :) For sure I can help you with choice # 2.

arthurspa commented 3 years ago

Hey, sorry guys. My bad. The thing is that I was always testing with python 3.8 and trusting pyflakes to analyse the code for possible incompatibilties with python 3.6 and 3.7. We have an action for python 3.6, 3.7 and 3.8, so I'd expect if I introduced something not supported, pyflakes would catch it. Anyway, thanks for reporting, @jlntrt

jlntrt commented 3 years ago

Many thanks to @arthurspa for the PR #93

This fixes the issue :)

(.venv) ➜  bot git:(fix-92-unexpected-capture-output-py36) python3 run.py --blogger-followers kwerfeldein --device ce01171159e094490c
[11/22 21:04:29]     INFO | GramAddict 1.0.5
[11/22 21:04:29]     INFO | Loading plugins . . .
[11/22 21:04:29]     INFO |   - ActionUnfollowFollowers: This plugin handles the functionality of unfollowing your followers
[11/22 21:04:29]     INFO |   - CoreArguments: This plugin simply adds core arguments
[11/22 21:04:30]     INFO |   - DataAnalytics: Generates a PDF analytics report of specified username session data
[11/22 21:04:30]     INFO |   - InteractBloggerFollowers: This plugin handles the functionality of interacting with a bloggers followers
[11/22 21:04:30]     INFO |   - InteractHashtagLikers: This plugin handles the functionality of interacting with a hashtags likers
[11/22 21:04:30]     INFO |   - LikeFromURLs: This plugin handles the functionality to likes all post from url reading a plaintext file
[11/22 21:04:30]     INFO | Instagram version: not found
[W 201122 21:04:30 __init__:203] atx-agent has something wrong, auto recovering
[D 201122 21:04:30 __init__:286] device ce01171159e094490c is online
[I 201122 21:04:31 init:155] uiautomator2 version: 2.11.2
[11/22 21:04:33]     INFO | -------- START: 2020-11-22 21:04:33.602267 --------
[11/22 21:04:33]     INFO | Open Instagram app
[D 201122 21:04:36 __init__:598] kill process(ps): uiautomator
[D 201122 21:04:38 __init__:617] uiautomator-v2 is starting ... left: 40.0s
[D 201122 21:04:39 __init__:617] uiautomator-v2 is starting ... left: 39.0s
[D 201122 21:04:40 __init__:617] uiautomator-v2 is starting ... left: 38.0s
[D 201122 21:04:41 __init__:617] uiautomator-v2 is starting ... left: 36.9s
[D 201122 21:04:42 __init__:617] uiautomator-v2 is starting ... left: 35.9s
[D 201122 21:04:43 __init__:617] uiautomator-v2 is starting ... left: 34.9s
[D 201122 21:04:44 __init__:617] uiautomator-v2 is starting ... left: 33.9s
[D 201122 21:04:45 __init__:617] uiautomator-v2 is starting ... left: 32.8s
[I 201122 21:04:45 __init__:581] uiautomator back to normal
philip-ulrich commented 3 years ago

Closing! 😄