Tkd-Alex / Telegram-InstaPy-Scheduling

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

cannot import name 'instapy' #4

Closed lee-android closed 6 years ago

lee-android commented 6 years ago

error:

Traceback (most recent call last): File "telegram-instapy.py", line 9, in from instapy import instapy ImportError: cannot import name 'instapy'

if you could help me with this, I'd appreciate it greatly.

Tkd-Alex commented 6 years ago

Clone the repo https://github.com/timgrossmann/InstaPy and copy the instapy folder inside this repo.

https://github.com/timgrossmann/InstaPy/tree/master/instapy

image

lee-android commented 6 years ago

Thank you, that seems to have done it. However, now I'm getting this error:

python3 telegram-instapy.py Traceback (most recent call last): File "telegram-instapy.py", line 244, in main() File "telegram-instapy.py", line 217, in main updater = Updater(telegram_token) File "/usr/local/lib/python3.6/site-packages/telegram/ext/updater.py", line 122, in init self.bot = Bot(token, base_url, request=self._request) File "/usr/local/lib/python3.6/site-packages/telegram/bot.py", line 108, in init self.token = self._validate_token(token) File "/usr/local/lib/python3.6/site-packages/telegram/bot.py", line 134, in _validate_token raise InvalidToken() telegram.error.InvalidToken: Invalid token

I have already followed the provided steps to create a bot, and I also copied the necessary information in the config.ini file as well.

Tkd-Alex commented 6 years ago

This error is reported by telegram-api when the token still not valid. Try to print the readed token from config.ini at first line of main() method.

def main():
    print (telegram_token)
    updater = Updater(telegram_token)

Compare printing with your token get from BotFather.

luigifaticoso commented 6 years ago
Traceback (most recent call last):
  File "telegram-instapy.py", line 292, in <module>
    main()
  File "telegram-instapy.py", line 265, in main
    updater = Updater(telegram_token)
  File "/Library/Python/2.7/site-packages/telegram/ext/updater.py", line 122, in __init__
    self.bot = Bot(token, base_url, request=self._request)
  File "/Library/Python/2.7/site-packages/telegram/bot.py", line 108, in __init__
    self.token = self._validate_token(token)
  File "/Library/Python/2.7/site-packages/telegram/bot.py", line 134, in _validate_token
    raise InvalidToken()

I'm getting the same error using the right token printed in the main and in the /Library/Python/2.7/site-packages/telegram/bot.py

Tkd-Alex commented 6 years ago

image This is an example. This working. Try to set manually token in variable without using ConfigParser.

luigifaticoso commented 6 years ago

This works! Nice

ArielEcker commented 6 years ago

I have an similar error... can you help me?

Traceback (most recent call last): File "C:\Ariel\2018\InstaPy-master\telegram-instapy.py", line 232, in main() File "C:\Ariel\2018\InstaPy-master\telegram-instapy.py", line 205, in main updater = Updater(telegram_token) File "C:\Python 3.6.4\lib\site-packages\telegram\ext\updater.py", line 122, in init self.bot = Bot(token, base_url, request=self._request) File "C:\Python 3.6.4\lib\site-packages\telegram\bot.py", line 108, in init self.token = self._validate_token(token) File "C:\Python 3.6.4\lib\site-packages\telegram\bot.py", line 134, in _validate_token raise InvalidToken() telegram.error.InvalidToken: Invalid token