agincel / TelegramBotFramework

A framework for making your own bots from scratch, derived from AdamTestBot.
1 stars 0 forks source link

Dependent on way of invoking. #1

Open vort3 opened 8 years ago

vort3 commented 8 years ago

When I run it as

telegram_bot.py

it works well, but if I do

python telegram_bot.py

it fails. Can this be fixed?…

agincel commented 8 years ago

Would you mind posting the error message? Thanks so much

vort3 commented 8 years ago

It repeats the same thing infinitely:

... Traceback (most recent call last): File "telegram_bot.py", line 31, in updates = bot.getUpdates(offset=newestOffset) File "C:\vortbot\telegram\bot.py", line 126, in decorator result = func(self, _args, _kwargs) File "C:\vortbot\telegram\bot.py", line 683, in getUpdates result = request.post(url, data) File "C:\vortbot\telegram\utils\request.py", line 93, in post result = urlopen(request).read() File "C:\Python27\lib\urllib2.py", line 154, in urlopen return opener.open(url, data, timeout) File "C:\Python27\lib\urllib2.py", line 431, in open response = self._open(req, data) File "C:\Python27\lib\urllib2.py", line 449, in _open '_open', req) File "C:\Python27\lib\urllib2.py", line 409, in _call_chain result = func(args) File "C:\Python27\lib\urllib2.py", line 1240, in https_open context=self._context) File "C:\Python27\lib\urllib2.py", line 1197, in do_open raise URLError(err) URLError: <urlopen error [Errno 10013] ╤фхырэр яюя√Єър фюёЄєяр ъ ёюъхЄє ьхЄюфюь,

Sorry for that incorrect coding at last line, I have Russian windows and it has some troubles with cyrillic in console.

agincel commented 8 years ago

Did you modify apikey.csv? You get a key from BotFather on Telegram.

agincel commented 8 years ago

You need to replace the dummy key in there with a valid one

vort3 commented 8 years ago

I replaced a key with one I got from @BotFather , and it works perfectly if I invoke script as "telegram_bot.py". I get error only when use "python.exe telegram_bot.py". Notice "python.exe" at beginning :-)

agincel commented 8 years ago

I'm only confused because the only way of running it is with "python.exe telegram_bot.py"

Running it without specifying Python shouldn't do much of anything.

The only other troubleshooting thing I can suggest right now is a silly question: the device you're running the bot on is connected to the internet, right?

vort3 commented 8 years ago

Of course :-) That's not a big problem for now, I run it with "telegram_bot.py" and it works fine. But something is wrong with that…

agincel commented 8 years ago

As long as it works for you. When you run it the other way it works as intended? You can send a message (try /ping) to a chat with the bot and it replies?

vort3 commented 8 years ago

Yep, bot works and does everything without any problems, as intended.