dev_appserver.py is giving me an error - python

After upgrading GAE to 1.7.6 on OS X Lion, I'm getting an error I can't resolve when I run dev_appserver.py. It was working fine in the previous version. Initially the error said I needed to install PyObjC and PIL, which I did, using pip. Now, it says can't open file '/usr/local/bin/_python_runtime.py': [Errno 2] No such file or directory. Here is the full error:
INFO 2013-04-01 23:01:15,091 sdk_update_checker.py:244] Checking for updates to the SDK.
INFO 2013-04-01 23:01:15,660 sdk_update_checker.py:272] The SDK is up to date.
INFO 2013-04-01 23:01:15,705 api_server.py:152] Starting API server at: http://localhost:50096
INFO 2013-04-01 23:01:15,721 dispatcher.py:98] Starting server "default" running at: http://localhost:8080
INFO 2013-04-01 23:01:15,759 admin_server.py:117] Starting admin server at: http://localhost:8000
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file '/usr/local/bin/_python_runtime.py': [Errno 2] No such file or directory
ERROR 2013-04-01 23:01:15,785 http_runtime.py:221] unexpected port response from runtime ['']; exiting the development server
INFO 2013-04-01 23:01:16,775 api_server.py:517] Applying all pending transactions and saving the datastore
INFO 2013-04-01 23:01:16,775 api_server.py:520] Saving search indexes
Exception in thread Thread-1 (most likely raised during interpreter shutdown)
I found a similar post about this here, but it was on a Windows 7 machine and it doesn't appear he's found a solution (or perhaps he did and didn't follow up). Any ideas?
Edit: It works with the GoogleAppEngineLauncher GUI but not the command line. Not sure why.

From my response to Fat Lotus, here's what worked for me:
I updated GAE Launcher again which recreated the symlinks and now it works fine. The current symlink that /usr/local/bin/_python_runtime.py links to is /Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-de‌​fault.bundle/Contents/Resources/google_appengine/_python_runtime.py

I've been having this problem as well (related to a Homebrew install); I've managed to get things working by using the following:
ln -s /usr/local/Cellar/google-app-engine/1.7.5/share/google-app-engine/_python_runtime.py /usr/local/bin/_python_runtime.py

I saw the same error in regards to _python_runtime.py not being found. It was caused by not running the GoogleAppEngineLauncher by first copying the application to the local drive.
Make sure you read the error messages carefully, as I didn't read all of them at first. Running the installer from the local disk resolved this issue, at least for me.

Related

An error occurred initializing the application server: Failed to locate pgAdmin4.py, terminating server thread

I am getting this error:
An error occurred initializing the application server: Failed to locate pgAdmin4.py, terminating server thread.
As it fails it will prompt to adjust the python and application path but I read an answer on Stack Overflow where the person said he deleted the path it worked for him and did so but it still gave me the same error and I don't see the prompt again.
So I went to pgAdmin official site only to see that if it fails I must enter python and application path. How can I configure the paths for the pgAmin. I am using Fedora 27.
Try to just delete the config file. You may have an old one from a previous install.
rm ~/.config/pgadmin/pgadmin4.conf
As it fails it will prompt to adjust the python and application path but read an answer on stackoverflow where the person said he deleted the path it worked for him and did so but it still gave me the same error and i don't see the prompt again
Probably your first error was actually
An error occurred initialising the application server:
Failed to launch the application server, server thread exiting.
Most likely you missing some dep like python3-flask-babelex
e.g on fedora install
sudo dnf install python3-flask-babelex
You see following error (one you mentioned) when you have misconfigured user config file. Which was created after you edited default values from prompt
An error occurred initializing the application server:
Failed to locate pgAdmin4.py, terminating server thread.
This error can be solved by either fixing your config or deleting it to use default values:
e.g. on Fedora checking that your user config is correct
vi ~/.config/pgadmin/pgadmin4.conf
Primarily check that path variables in [General] section are ok.
# example
[General]
ApplicationPath=/usr/lib/python3.6/site-packages/pgadmin4-web/
PythonPath=/usr/lib/python3.6/site-packages:/usr/lib64/python3.6/site-packages
For me, the solution was to sudo dnf remove pgadmin4* then sudo find / -iname "*pgadmin4*" and delete any scraps lying around, then sudo dnf install pgadmin4* - everything is now working fine.

Use tika with python, runtimeerror: unable to start tika server

I am trying to use the tika package to Parse files. Tika is successfully installed, tika-server-1.18.jar runned with Code in cmd Java -jar tika-server-1.18.jar
My code in the Jupyter is:
Import tika
from tika Import parser
parsed = parser.from_file('')
However, I receive below error:
2018-07-25 10:20:13,325 [MainThread ] [WARNI] Failed to see startup
log message; retrying... 2018-07-25 10:20:18,329 [MainThread ]
[WARNI] Failed to see startup log message; retrying... 2018-07-25
10:20:23,332 [MainThread ] [WARNI] Failed to see startup log
message; retrying... 2018-07-25 10:20:28,340 [MainThread ] [ERROR]
Tika startup log message not received after 3 tries. 2018-07-25
10:20:28,340 [MainThread ] [ERROR] Failed to receive startup
confirmation from startServer.
RuntimeError: Unable to start Tika Server.
According to Apache Tika's site, all new versions of the tika-server.jar will require Java 8.
24 April 2018: Apache Tika Release
Apache Tika 1.18 has been released! This release includes bug fixes (e.g. extraction from grouped shapes in PPT), security fixes and upgrades to dependencies. PLEASE NOTE: The next versions will require Java 8. Please see the CHANGES.txt file for the full list of changes in the release and have a look at the download page for more information on how to obtain Apache Tika 1.18.
Current outdated docs for tika Python library claim that Java 7 is needed, but now Java 8 must be installed. This is because the current version of tika-server.jar is automatically downloaded at runtime if not found in your temp file.
After installing Java 8, my basic test code launched the server and worked without error.
After you import Tika you need to initialize the Java Server
import tika
tika.initVM()
from tika import parser
parsed = parser.from_file('') //file name should be here
Download Java. If you already have a version of Java installed, try updating it to the latest version. The version that works for me is 1.18.
You have not passed an argument (specified a file) in your line:
parsed = parser.from_file('')
Give it a file to chew on e.g.,
parsed = parser.from_file('myfile.txt')
The server didn't start & presumably this no log warning gets triggered - see line 644 in the source at the Github
then another error message tells you it ain't going to play...
I faced similar issue. Tried all steps mentioned here, nothing helped.
How I solved it:
checked the log file of tika and tika-server.
For windows, you can find it inside C:/Users/your_user_name/AppData/Local/Temp/
Found that tika-server log had mentioned port already in use error.
check below log snippet -
INFO: Setting the server's publish address to be http://localhost:9998/
WARNING: FAILED SelectChannelConnector#localhost:9998: java.net.BindException: Address already in use: bind
java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at org.eclipse.jetty.server.nio.SelectChannelConnector.open(SelectChannelConnector.java:187)
at org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:316)
at org.eclipse.jetty.server.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:265)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.eclipse.jetty.server.Server.doStart(Server.java:293)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(JettyHTTPServerEngine.java:417)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.activate(JettyHTTPDestination.java:179)
at org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractObservable.java:49)
at org.apache.cxf.binding.AbstractBindingFactory.addListener(AbstractBindingFactory.java:95)
at org.apache.cxf.jaxrs.JAXRSBindingFactory.addListener(JAXRSBindingFactory.java:88)
at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:123)
at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:206)
at org.apache.tika.server.TikaServerCli.main(TikaServerCli.java:213)
This clearly indicated that another process is already running in same port. So I just needed to kill java process running on port 9998 (which I assumed might have been defunct)
Once I killed the process in task manager, I tried rerunning the python script, it worked correctly.
To cross check you can also run the tika-server.jar file present in same path - C:/Users/your_user_name/AppData/Local/Temp/ using below command and check if it fails or runs correctly: java -jar tika-server.jar
Hope this will be helpful to someone in future.
If your are using Ubuntu 20.01 (and 18.04) like me, the solution is to Install Oracle JDK 17. Do the following:
sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo apt install oracle-java17-installer
Type java -version on the terminal. You should see the following print-out:
java version "17.0.1" 2021-10-19 LTS`
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)`
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)
tika should then be able to extract text from your pdf in python.
parser.from_file(<your pdf file>)

kazoo restarted zookeeper, the watch threw an exception

My configuration:
zookeeper: 3.4.10
os: ubuntu 16.04
python: 2.7
kazoo: 2.3.1
The code I run in IPython:
When I restarted zookeeper, with bin/zkServer.sh restart, the shell shows the exception as below:
If I delete the watch and replace with a listener, the listener works well.
I don't know why, and I read the info from google and github/kazoo, but I found no explanation of how to solve the problem.
P.S.: Someone said because the session of the client connection expired and was lost, the session_id is not the same with the retry connection when the zookeeper restarts
I believe this is related to a bug that was introduced in 2.3.1 from the following PR:
https://github.com/python-zk/kazoo/pull/305
This is being looked into, and may be rolled back. In the meantime, try using a pre 2.3 version of kazoo.

nginx permission denied while reading upstream - even when run as root

I have a flask app running under uWSGI behind nginx.
*1 readv() failed (13: Permission denied) while reading upstream, client: 10.0.3.1, server: , request: "GET /some/path/constants.js HTTP/1.1", upstream: "uwsgi://unix:/var/uwsgi.sock:", host: "dev.myhost.com"
The permissions on the socket are okay (666, and set to the same user as nginx), in fact, even when I run nginx as root I still get this error.
The flask app/uwsgi is sending the request properly. But it's just not being read by Nginx. This is on Ubuntu Utopic Unicorn.
Any idea where the permission might be getting denied if the nginx process has full access to the socket?
As a complicating factor this server is running in a container that has Ubuntu 14.04 installed in it. And this setup used to work... but I recently upgraded the host to 14.10... I can fully understand that this could be the cause of the problem. But before I downgrade the host or upgrade the container I want to understand why.
When I run strace on a worker that's generating this error I see the call it's making is something like this:
readv(14, 0x7fffb3d16a80, 1) = -1 EACCES (Permission denied)
14 seems to be the file descriptor created by this system call
socket(PF_LOCAL, SOCK_STREAM, 0) = 14
So it can't read from a local socket that it has just created?
Okay! So the problem was, I think, related to this bug. It seems that even though apparmor wasn't configured to prevent access to sockets inside the containers it was actually doing something to prevent reading from them (though not creation...) so turning off apparmor for the container (following these instructions) worked to fix it.
The two relevant lines were:
sudo apparmor_parser -R /etc/apparmor.d/usr.bin.lxc-start
sudo ln -s /etc/apparmor.d/usr.bin.lxc-start /etc/apparmor.d/disabled/
and adding
lxc.aa_profile = unconfined
To the containers config file.
NB: These errors were not recorded in any apparmor logs.
This problem was probably introduced in kernel 3.16, because it does not reproduce on 14.04 with 3.13 kernel. Strange apparmor bug was indeed responsible for that.
Unfortunately #aychedee's solution didn't work for me. In my case I had to add the following parameter to docker run command to get rid of the issue:
docker run --security-opt apparmor:unconfined ...
If someone's aware what is the current state of the issue, please consider adding comment under this answer :)

Cannot launch appengine SDK, even after re-install

Today when I attempted to launch the appengine SDK (python) I saw the error "Errors occurred" - see image below. More details:
The log file referenced in the error message does not exist at that location
I tried uninstalling the SDK entirely, and re-installing 1.9.13.msi (python)
It's on Windows 7, 74 Pro, python 2.7
I tried renaming the app files at %APPDATA%/local/temp/appengine.*
I'd been using app engine fine for weeks on this machine. Yesterday my machine failed to go to sleep properly, as it often does. At power up it booted into a new/clean Windows - ie. it crashed and lost all its state. (Warning dont buy a Thinkpad T440s for Windows until they have this fixed..). I suspect that something was corrupted when the machine crashed.
I tried restarting Windows, of course ;)
Any ideas on how to fix this?
Found the answer here: https://groups.google.com/forum/#!msg/google-appengine/Uphb04hV2tg/K6vL4osY_xgJ
I renamed the file 'google_appengine_launcher.ini' at users/[my profile]/Goolge

Categories