Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError while running Google App Engine test project

I am new to Google App Engine and so, I just followed the procedure to test an application which just prints "hello world".

(followed according to Google App Engine Documentation)

The project folder name is "GoogleApp"

This is my Python file:

File Name : sayHello.py

#!/usr/bin/env python

def main():
    print "hello"
    pass

if __name__ == '__main__':
    main()

This the yaml file

File Name : app.yaml

application: GoogleApp
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /.*
  script: sayHello.py

When ever I just run the project in Google App Engine Launcher, this is the log error I am getting

2012-04-19 10:52:23 Running command: "['C:\\Python27\\pythonw.exe', 'C:\\Program Files\\Google\\google_appengine\\dev_appserver.py', '--admin_console_server=', '--port=8080', 'D:\\Code\\Projects\\IRCmathBot\\GoogleApp']"
Traceback (most recent call last):
  File "C:\Program Files\Google\google_appengine\dev_appserver.py", line 125, in <module>
    run_file(__file__, globals())
  File "C:\Program Files\Google\google_appengine\dev_appserver.py", line 121, in run_file
    execfile(script_path, globals_)
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_appserver_main.py", line 157, in <module>
    from google.appengine.tools import appcfg
  File "C:\Program Files\Google\google_appengine\google\appengine\tools\appcfg.py", line 41, in <module>
    import mimetypes
  File "C:\Python27\lib\mimetypes.py", line 29, in <module>
    import urllib
  File "C:\Python27\lib\urllib.py", line 26, in <module>
    import socket
  File "C:\Python27\lib\socket.py", line 47, in <module>
    import _socket
ImportError: Module use of python25.dll conflicts with this version of Python.
2012-04-19 10:52:25 (Process exited with code 1)

Actually, I use Python 2.7. The above log says that python25.dll conflicts with version of python.

I don't know what exactly it means but I could interpret that

  1. It should either support only python 2.5 or
  2. It I should have used python 2.5 code.

as the 2nd isn't possible and Google supports 2.7, I don't know what is this error.

Try to figure out myself but couldn't succeed.

like image 916
Surya Avatar asked Apr 19 '12 05:04

Surya


2 Answers

I had a very similar problem (while running the tutorial code), and solved it by checking my PythonPath system environment variable.

For me, OpenCV edited the PythonPath variable to point to its own directory structure instead of the base Python installation itself.

You can edit the environment variables by opening up the 'Advanced System Properties' window and clicking on the 'Environment Variables' button. The 'PythonPath' variable under 'System Variables'. At the minimum, it should include the path of your python executable, such as 'C:\Python27\'.

like image 109
Doc Sohl Avatar answered Nov 15 '22 08:11

Doc Sohl


Have you tried in command-line? Forget the launcher. I had same problem! I re-installed Python several times, changed versions. It was hilarious. With version 2.5 launcher can start the server, but the application doesn't work, but I can upload it online through launcher. With Python ver. 2.7, launcher displays same problems you're dealing with. I also can't get the server started locally. But command-line works well, both starting the server locally and uploading online. So I'll stick with version 2.7. Hope it helps, let me know..

like image 40
Uglješa Ijačić Avatar answered Nov 15 '22 08:11

Uglješa Ijačić