ImportError when running a Google App Engine test project

I'm new to the Google App Engine, so I just followed the verification process for an application that just prints "hello world."

(as per 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 yaml file

File Name: app.yaml

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

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

When I just start a project in the Google App Engine Launcher, this is a log error that I get

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 am using Python 2.7. The above log says python25.dll is conflicting with the python version.

I don’t know what exactly this means, but I could understand that

  • It should only support python 2.5, or
  • This I had to use python 2.5 code.

, Google 2.7, , .

, .

+5
11

- Python 2.7 - Python 2.5. Python .

0

( ), , PythonPath.

OpenCV PythonPath, , Python.

, " " " ". "PythonPath" " ". , python, "C:\Python27 \".

+5

? . ! Python , . . 2.5 , , . Python ver. 2.7, , . . , , . 2.7. , , .

+2

, WSGI. . :

: helloworld.py

import webapp2

class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.out.write('Hello, WebApp World!')

app = webapp2.WSGIApplication([('/', MainPage)])

: app.yaml

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

handlers:
- url: /.*
  script: helloworld.app

Python2.7 Google AppEngine, , Hello World.

+1

3 . , / . :

Google Drive Perference, Google Google- (Google , , Python 2.5 _socket library

python GAE python27 GAE , , c:\python27 ( c:\mypython27. , GAE, .

.

+1

, GAE PATH? .

, , Python 2.7 lib_socket.pyd lib GAE, GAE PATH, .

, . - , / , , : (

  • "", "", , ;
  • " ", , ;
  • "", " ", , , ;
  • "PATH" "Path" ( ): GAE, GAE.
0

, PYTHONPATH ".". !

0

PYTHON_PATH

"C:\Program Files\Google\google_appengine; C:\Program \Google\google_appengine\Lib\antlr3 C:\Program \Google\google_appengine\Lib\django_0_96; C:\Program \Google\google_appengine\Lib\fancy_urllib; C:\Program \Google\google_appengine\Lib\; C:\Program \Google\google_appengine\Lib\IPAddr; C:\Program \Google\google_appengine\Lib\simplejson; C:\Program \Google\google_appengine\Lib\WebOb; C:\Program Files\Google\google_appengine\Lib\YAML\Lib"

, django 0.96 python 2.5, django 1.4, .

"C:\Program Files\Google\google_appengine; C:\Program \Google\google_appengine\Lib\antlr3 C:\Program \Google\google_appengine\Lib\-1.4; C:\Program \Google\google_appengine\Lib\fancy_urllib; C:\Program \Google\google_appengine\Lib\; C:\Program \Google\google_appengine\Lib\IPAddr; C:\Program \Google\google_appengine\Lib\simplejson; C:\Program \Google\google_appengine\Lib\WebOb; C:\Program Files\Google\google_appengine\Lib\YAML\Lib"

, , PATH, PYTHON_PATH, , python. .

0

PYTHONPATH. (System → Environment variables) , 2.4 python ( C:\Python27), . - Google appengine.

0
ImportError: Module use of python25.dll conflicts with this version of Python.

, python25.dll Python 2.7. python25.dll Google App Engine Launcher Windows C:\Program Files\Google\google_appengine\launcher

Python 2.7 - Launcher, Python . , google_appengine/dev_appserver.py :

from pprint import pprint
pprint(sys.path)

, :

...
'C:\\OpenCV2.3\\opencv\\build\\python\\2.7',
'C:\\Google\\google_appengine\\launcher',
'C:\\Windows\\system32\\python27.zip',
'C:\\Python27\\DLLs',
...

Python.msi SDK 1.8.8, , , suxx, Google - SDK . , dev_appserver.py:

# --- Repair sys.path after broken GAE Windows Launcher
# see http://stackoverflow.com/questions/10222342/
ROOT = os.path.abspath(os.path.dirname(__file__))
LAUNCHPATH = os.path.join(ROOT, 'launcher')
if LAUNCHPATH in sys.path:
  sys.stderr.write('[BUG] GAE Windows Launcher detected. Fixing..\n')
  sys.path.remove(LAUNCHPATH)
# /--

, , GAE. № 8568 AppEngine, , -.

0

PYTHONPATH ? Google App Engine Launcher, !

0

All Articles