I'm trying to run a server application in python to run the python code I have used the WSGI example code from the python documents and it still doesn't work I get the same error every time I try to run this code. I'm using a raspberry pi 3 with python 3.10.4 anyone know how to solve this thanks.
the error and line of code it shows the error on is below
run / compiler error =
Traceback (most recent call last):
File "/home/pi/wsgiPythonTest.py", line 18, in
with make_server('', 8000, simple_app) as httpd:
AttributeError: exit
line of code in and linked code in question the first line shown is line 18
with make_server('', 8000, simple_app) as httpd:
print("Serving on port 8000...")
httpd.serve_forever()
does anyone know if I'm missing a python module that's required for this to work and if so how do I install it I'm running the code in raspian. thanks
Related
I'm currently working on a programme to automate some function for router configuration and I've managed to create a loopback interface between GNS3 and my computer so that I can connect python via telnet.
At first, the code ran smoothly and I had no problem, but when I switched to another router, it works only for a few commands and then it suddenly stops and I can't figure why.
This is the error I get:
Traceback (most recent call last):
File "C:\Licenta - program\test1\main.py", line 147, in <module>
tn.write(b"ip add ")
File "C:\Users\carme\AppData\Local\Programs\Python\Python39\lib\telnetlib.py", line 292, in write
self.sock.sendall(buffer)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
Any suggestions are welcomed!
Thank you!
When I ran $ snakeviz code_profile.prof from CLI :
snakeviz web server started on 127.0.0.1:8080; enter Ctrl-C to exit http://127.0.0.1:8080/snakeviz/%2Fhome%2Fatmadeep%2FProjects%2FtrafficAI-master%2Fprofile_info-60.prof snakeviz: error: no web browser found: could not locate runnable browser
After some search, I tried running it in server only mode and got this error using --server argument :
Traceback (most recent call last): File "/home/atmadeep/anaconda3/envs/work-env/lib/python3.7/site-packages/tornado/web.py", line 1681, in _execute result = self.prepare() File "/home/atmadeep/anaconda3/envs/work-env/lib/python3.7/site-packages/tornado/web.py", line 2430, in prepare raise HTTPError(self._status_code) tornado.web.HTTPError: HTTP 404: Not Found
What might be the problem here? Is the profile generated corrupt or am I not understanding something related to snakeviz.
Note: I'm not running this code in jupyter-notebook.
So, here's the solution. from the console, run:
$python -m snakeviz profile.prof --server
When running from console, snakeviz needs to be called as shown above.
on a server you have to add --server argument and to click on the link in the terminal. Putting a threshold at 1/100 helps also.
I am new to Python Flask and Python.
I use Python 3.7 and Ubuntu.
I have done export FLASK_APP=emptst
And have been executing an online application. It was running fine
In the same environment I have a pure python program & I executed it from command prompt.
I think while executing this the python flask server was listening. It is a localhost server
After this I have stopped the server and ran the python online again.The server came up But it started executing the python program that I executed from command line.
And when I removed the program from the mflask directory it is giving the following error.
Traceback (most recent call last):
File "/home/ss/anaconda3/envs/test/lib/python3.7/site-packages/flask/cli.py", line 240, in locate_app
__import__(module_name)
File "/home/ss/mflask/emptst_new.py", line 2, in <module>
import recognize_faces_video_file1_200119
ModuleNotFoundError: No module named 'recognize_faces_video_file1_200119'
Pls advise. Basically i need it to run the online application emptst and not execute the batch application which it executes currently, whenever i start the server
I am trying to get a python service to run under Windows 7 however I am unable to start it.
I have started by installing the service using
c:\amsconnector>amsconnector.py --username domain\admin --password ************ install
Installing service AMS Acomba Connector
Service installed
After that, I run
c:\amsconnector>amsconnector.py start
Starting service AMS Acomba Connector
When I check the running services list, I notice that the service is not running and when checking the event log, I am presented with this stacktrace
Python could not import the service's module
Traceback (most recent call last):
File "C:\amsconnector\amsconnector.py", line 343, in <module>
win32serviceutil.HandleCommandLine(AMSConnectorService)
File "C:\Python27\lib\site-packages\win32\lib\win32serviceutil.py", line 521, in HandleCommandLine
usage()
File "C:\Python27\lib\site-packages\win32\lib\win32serviceutil.py", line 505, in usage
sys.exit(1)
SystemExit: 1
%2: %3
The line 343 of amsconnector.py looks like this
if True or __name__ == '__main__':
win32serviceutil.HandleCommandLine(AMSConnectorService)
After checking out the source code of win32serviceutil.py, it appears that the service is just printing out the win32service usage dialog instead of actually running the python class. I am completely confused!
Thanks roeland!
I was able to fix the issue by simply removing the "True or" part of the last line leaving it like this:
if True or __name__ == '__main__':
win32serviceutil.HandleCommandLine(AMSConnectorService)
What can cause this error?
I get these errors every time a client accesses my server.
it hapens only once in each request.
the script runs with seemingly no problems, but i don't know if there are hidden implications or complication that result from this error that i'm not aware of.
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/flup/server/fcgi_base.py", line 982, in _setupSocket
sock.getpeername()
fcgi_base
error: [Errno 88] Socket operation on non-socket
i'm running python as cgi ,web.py, linux (ubuntu12)
what can be the cause of this error?
How can I investigate it?