I'm making a Telegram bot on python and today i deployed it on Heroku. The bot had been deployed successfully but i'm having some troubles: first of all, i get an error when being redirected to my app's web page. After that i decided to check my app's logs, and i found this error:
telepot.exception.TelegramError: ('Conflict: terminated by other long poll or webhook', 409, {'ok': False, 'error_code': 409, 'description': 'Conflict: terminated by other long poll or webhook'})
I tried to see if the telegram bot was running, and it is, but instead of answering once to a command, it answer twice. The problem is not with the code, since when i run it locally from my ide, everything is alright.
I tried to find the problem, and i thought that it was another python script running on heroku, so i turned it off, but the problem was still there. I even thought that the script was running locally, but even with my laptop turned off, i get two answers.
Related
I have been working on a flask application and it has been working just fine. however, for a couple of hours now, i have not been able to run my application on the web. After running the script on command line as usual, i would copy the ip address to my browser in order to display its content but will not respond anymore. I have tried changing port, and other troubleshooting i suppose should work but has still not been able to get it fixed. Any assistance is highly appreciated.
The error message is " this site can not be reached" when is actually running on the server in command line.
Every time I try to run a script with pythonw instead of python, it'll show up in the task manager for a split second and then crash.
I am currently working on a discord bot and have the bot message the server every time the script successfully runs, and the bot never says anything but it does when I use normal python to open it
For others who arrive here because they have the same "pythonw shows up in Task Manager briefly and then crashes" problem, it's worth noting that this will happen if you try to execute invalid Python code with pythonw.exe. No errors are displayed, but errors are displayed if you try to run invalid Python code with python.exe, as shown in this screenshot:
A Discord bot isn't something suitable to run with pythonw. All of the context is in the terminal. I used heroku to host my discord bot. I also used this video to help with the setup.
I am trying to create a web application using flask. I have already gotten somewhat comfortable with using python, and have done so using spyder, inside of Anacanda Navigator. Now I am playing around with flask doing basic functions and have successful so far by testing it out in local server 127.0.0.1:5000. The problem I am having is that I cannot stop the server once I run the script in spyder. I have stopped the script and run other scripts through the console, but the local server remains the same.
The reason this is a problem for me is because when I try to change files and run a different flask script, the server does not update with the new information. For example, if I run a flask script that returns "Hello World" on the main page, and then I stop that file, open a new file that has a different flask script that returns "The sky is blue" the server does not change when I check it on chrome or any other browser. It will onyl return "Hello World"
I have been able to fix this problem by completely restarting my computer, but I am wondering if there is another way, just to restart the local server, 127.0.0.1:5000. Thank You!
Also I am using windows
I do : "Run > Configuration per file > Execute in an external system terminal",
then when you run your .py containing the app.run, it will be launched in an external console. If you close the console the server will be closed too.
To Kill the local server, you may use Ctrl+C command and not any other command. This command is also mentioned when the server is up and running.
I've been having this precise issue and have been smashing my head against the wall for a couple of hours. I posted the referenced StackOverflow question (my first actually) and it seems that running a script from inside Spyder is the wrong way to go as it leaves runaway background processes running, even after restarting Spyder.
I got the recommendation to only launch my *.py code from the command prompt. Furthermore I was told to do this:
set FLASK_APP=main1.py then set FLASK_DEBUG=1 then flask run
though I'm not sure what that does, so I will investigate. I was about to restart my computer as a last ditch effort until I looked in my Windows Task Manager and found some Python tasks running. After [end task] them both I was able to launch the updated webpage on my local host.
I have a situation where if I run Apache with wsgi (now uninstalled), a test website works, but running the same server with runserver 0.0.0.0:8080 gives ERR_CONNECTION_REFUSED from local or remote (even with the apache2 service stopped).
Edit: I don't think it's Apache, I've reproduced the problem on a clean server with no Apache installed, so unless Apache somehow modified something under source control it's not that
My knowledge of web details is hazy, I don't even know where to troubleshoot this problem - the devserver runs (runserver prints as expected and doesn't give any errors) but never receives a request, I have nothing in iptables.
Sorry for anyone who read this, it would probably have been impossible to solve given my supplied information.
What had actually happened was that I'd been having to modify my wsgi.py script in order to make it happy inside the Apache server, and I'd added a line which said "os.system('/bin/bash --rcfile )" to try and make sure that when running inside apache it got the virtualenv activated.
This line must have been causing some strange problem, another symptom was that I realised when I was running "runserver", it wasn't crashing the the python process was backgrounding itself, where normally it runs inside that console window.
Thanks everyone who asked questions helping me debug!
I recently started developing Django using Pydev in Eclipse, along with several other people I know, and I keep losing several hours of productivity a day to this error that I can't seem to debug. Essentially, sometimes after starting up my django run configuration, I'll go to the URL http://127.0.0.1:8000/foo and it simply spits me back this response:
<h1>Page not found: /foo</h1>
At first I could reproduce this behavior all the time; any time I had multiple workspaces of eclipse open and shut down my Django server once, the server wouldn't actually shut down, but it would just keep serving the page not founds until I shut down both instances of Eclipse.
Stopping doing that and it seemed to work, but then it intermittently seemed to start back up again. When this happens, it will literally not stop happening until I close eclipse, and the eclipse.exe process will hang (and continue to server Page not found pages) until I manually go into the process and kill it. Sometimes, that won't even fix it, and it'll break itself the first time I try to start Django back up.
I'm on the stable build of PyDev and Eclipse 3.6.1.
Any idea what's going on? This is unbelievable frustrating, especially because I tend to like the IDE with this exception.
Are you by any chance using a run configuration to launch your development server? Because that kept happening to me too. It seems that eclipse isn't cleanly closing django when you stop it from the IDE and it's holding on to the http port. In that sense you're sending requests to a zombie server instance, hence the not founds. I have since resorted to launching django from the command line. Not the prettiest solution, I admit.