Tkd-Alex / Telegram-InstaPy-Scheduling

A Telegram bot for scheduling InstaPy
152 stars 38 forks source link

Error when executing "python telegram-instapy.py" #12

Closed NikolasP98 closed 5 years ago

NikolasP98 commented 6 years ago

(all files within C:\Users\nikol\Documents\GitHub)

  1. Cloned python-telegram-bot within the GitHub folder, ran pip install python-telegram-bot --upgrade (followed other installation steps as indicated by the repo instructions)

  2. Cloned the Telegram-InstaPy-Scheduling repo inside my InstaPy folder and followed installation steps (got the token from bot_father and the Chat Id, filled my usrname and pswd, etc etc.), tried running python telegram-instapy.py and got the following error on my command prompt

Running python 3.7 (I don't believe it's a version compatibility error)

C:\Users\nikol\Documents\GitHub\InstaPy\Telegram-InstaPy-Scheduling>python telegram-instapy.py
Traceback (most recent call last):
  File "telegram-instapy.py", line 9, in <module>
    from instapy import InstaPy
  File "C:\Users\nikol\AppData\Local\Programs\Python\Python37\lib\site-packages\instagram_py-0.0.1-py3.7.egg\instapy\__init__.py", line 2, in <module>
    from .instapy import InstaPy
  File "C:\Users\nikol\AppData\Local\Programs\Python\Python37\lib\site-packages\instagram_py-0.0.1-py3.7.egg\instapy\instapy.py", line 21, in <module>
    from .clarifai_util import check_image
  File "C:\Users\nikol\AppData\Local\Programs\Python\Python37\lib\site-packages\instagram_py-0.0.1-py3.7.egg\instapy\clarifai_util.py", line 3, in <module>
    from clarifai.rest import ClarifaiApp, Image as ClImage
  File "C:\Users\nikol\AppData\Local\Programs\Python\Python37\lib\site-packages\clarifai-2.0.32-py3.7.egg\clarifai\rest\__init__.py", line 3, in <module>
  File "C:\Users\nikol\AppData\Local\Programs\Python\Python37\lib\site-packages\clarifai-2.0.32-py3.7.egg\clarifai\rest\client.py", line 22, in <module>
ModuleNotFoundError: No module named 'jsonschema'

The following code is my telegram-instapy.py code:

def threadRun():
    try:
        #################################################
        # Put your instaPy code, the following it's mine ;)
        #################################################

        # Get instagram data from config.ini
        insta_username = config.get('instapy', 'username');
        insta_password = config.get('instapy', 'password');

        # Login
        session = InstaPy(username=insta_username, password=insta_password, nogui=True)
        session.login()
        #interact with user if follower/following ratio meets the minimum potency ratio (+ is for -er>-ing, - is for -er<-ing)
        session.set_relationship_bounds(enabled=True,
                 potency_ratio=None,
                  delimit_by_numbers=True,
                   max_followers=8500,
                    max_following=4490,
                     min_followers=100,
                      min_following=56)

#follow
        session.set_do_follow(enabled=False, percentage=25, times=1)

        session.follow_user_followers(['pierotatts', 'somerray', 'brunobragagnini','revargasfitnessblog', 'thenotoriousmma'], amount=30, sleep_delay=600, randomize=True, interact=False)

        #comments
        session.comment_by_locations(['220021938/lima-peru/'], amount=50)
        session.set_delimit_commenting(enabled=True, max=32, min=0)

        session.set_do_comment(enabled=True, percentage=10)
        session.set_comments(['Buena pic!', 'Tus fotos > mis fotos!','good shitt','@{} enseñame tomar fotos asi', 'envidio tus fotos'], media='Photo')
        session.set_comments(['@{} Me encanto el vid', 'good shittt', 'Me gusta como esta editado!'], media='Video')

        #like
        session.set_delimit_liking(enabled=True, max=1000, min=5)
        session.like_by_locations(['220021938/lima-peru/'], amount=100)
        session.set_smart_hashtags(['model', 'man','Peru','Lima', 'instafitness','instamodel','fitness','model','fashionblogger','malemodels','malemodel','malefashion','Photography'], limit=3, sort='top', log_tags=True)
        session.like_by_tags(amount=10, use_smart_hashtags=True)

        session.like_by_locations(['220021938/lima-peru/'], amount=50, media='Photo')

        #Unfollow
        session.set_dont_unfollow_active_users(enabled=False, posts=6)

        session.unfollow_users(amount=1000, InstapyFollowed=(True, "all"), style="FIFO", unfollow_after=12*60*60, sleep_delay=100)

        #Logout
        session.end()
    except:
        import traceback
        print(traceback.format_exc())
NikolasP98 commented 6 years ago

My code works fine if I run quickstart.py on its own.

Tkd-Alex commented 6 years ago

Copy the instapy folder in the same folder of Telegram-InstaPy-Scheduling. https://github.com/timgrossmann/InstaPy/tree/master/instapy

image

NikolasP98 commented 6 years ago

Copied and pasted the contents of the instapy folder into the Telegram-InstaPy-Scheduling folder as instructed. I tried running telegram-instapy.py and got the following error message:

C:\Users\nikol\Documents\GitHub\InstaPy\Telegram-InstaPy-Scheduling>python telegram-instapy.py
Traceback (most recent call last):
  File "telegram-instapy.py", line 9, in <module>
    from instapy import InstaPy
  File "C:\Users\nikol\Documents\GitHub\InstaPy\Telegram-InstaPy-Scheduling\instapy.py", line 22, in <module>
    from .comment_util import comment_image
ImportError: attempted relative import with no known parent package
Tkd-Alex commented 6 years ago

I'm not sure about this. Instapy script can't find other import file for example: comment_util.py Can you send your folder tree?