All of a sudden, Webapp2 can not be found by the python interpreter

综合编程 2018-04-22 阅读原文

I'm running the latest Python 2.7 and Google App Engine SDK on Windows. Everything is working fine until tonight, now python is throwing import errors about webapp2 in every app I have and all local projects are returning blank pages.

I've seen all the posts about the path, etc but its not working. I installed Bluestacks the other day and I think that POS did something. I've done several uninstall and reinstalls of everything python related to no avail.

Here is my path string if it helps

(User PATH)

D:Program Files  (x86)Googlegoogle_appenginelib;C:Python27;C:Python27Scripts;D:Program Files (x86)Googlegoogle_appengine

(System PATH)

C:Python27;C:Program Files (x86)InteliCLS Client;C:Program FilesInteliCLS Client;C:PROGRAM FILES (X86)AMD APPBINX86_64;C:PROGRAM FILES (X86)AMD APPBINX86;C:PROGRAM FILESCOMMON FILESMICROSOFT SHAREDWINDOWS LIVE;C:PROGRAM FILES (X86)COMMON FILESMICROSOFT SHAREDWINDOWS LIVE;%SYSTEMROOT%SYSTEM32;%SYSTEMROOT%;%SYSTEMROOT%SYSTEM32WBEM;%SYSTEMROOT%SYSTEM32WINDOWSPOWERSHELLV1.0;D:PROGRAM FILESATI TECHNOLOGIESATI.ACECORE-STATIC;C:PROGRAM FILES (X86)WINDOWS LIVESHARED;C:PROGRAM FILES (X86)COMMON FILESINTUITQBPOSSDKRUNTIME;C:PROGRAM FILES (X86)GOOGLEGOOGLE APPS SYNC;C:PROGRAM FILES (X86)GOOGLEGOOGLE APPS MIGRATION;C:PROGRAM FILESCOMMON FILESNEATRECEIPTSDRIVERSM12;D:PROGRAM FILES (X86)GOOGLEGOOGLE_APPENGINE;D:PROGRAM FILES (X86)GOOGLEGOOGLE_APPENGINELIB;;D:PROGRAM FILES (X86)QUICKTIMEQTSYSTEM;C:Program FilesIntelIntel(R) Management Engine ComponentsDAL;C:Program FilesIntelIntel(R) Management Engine ComponentsIPT;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsDAL;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsIPT;C:Program Files (x86)IntelOpenCL SDK3.0binx86;%SystemRoot%system32;%SystemRoot%;%SystemRoot%System32Wbem;%SYSTEMROOT%System32WindowsPowerShellv1.0

I created a PYTHONPATH variable:

D:Program Files (x86)Googlegoogle_appenginelib;

The error I get when running anything in Aptana or the command line:

Traceback (most recent call last): File "D:DropboxDropboxPython FilesUdacity PythonBlogBlogmain.py", line 17, in import webapp2 ImportError: No module named webapp2

Could there be Environmental variables GAE sets that I'm missing now? Please help, I'm at my wits end.

Thanks!

Update

In response to jacek2v, the output is

C:Python27>python "D:Program Files (x86)Googlegoogle_appenginedev_appserver .py" "D:DropboxDropboxPython FilesUdacity Pythonblogblogmain.py" Traceback (most recent call last): File "D:Program Files (x86)Googlegoogle_appenginedev_appserver.py", line 1 97, in _run_file( file
, globals()) File "D:Program Files (x86)Googlegoogle_appenginedev_appserver.py", line 1 93, in _run_file execfile(script_path, globals_) File "D:Program Files (x86)Googlegoogle_appenginegoogleappenginetoolsde vappserver2devappserver2.py", line 872, in main() File "D:Program Files (x86)Googlegoogle_appenginegoogleappenginetoolsde vappserver2devappserver2.py", line 865, in main dev_server.start(options) File "D:Program Files (x86)Googlegoogle_appenginegoogleappenginetoolsde vappserver2devappserver2.py", line 657, in start options.yaml_files) File "D:Program Files (x86)Googlegoogle_appenginegoogleappenginetoolsde vappserver2application_configuration.py", line 549, in init
module_configuration = ModuleConfiguration(yaml_path) File "D:Program Files (x86)Googlegoogle_appenginegoogleappenginetoolsde vappserver2application_configuration.py", line 82, in init
self._yaml_path) File "D:Program Files (x86)Googlegoogle_appenginegoogleappenginetoolsde vappserver2application_configuration.py", line 266, in _parse_configuration return appinfo_includes.ParseAndReturnIncludePaths(f) File "D:Program Files (x86)Googlegoogle_appenginegoogleappengineapiappi nfo_includes.py", line 63, in ParseAndReturnIncludePaths appyaml = appinfo.LoadSingleAppInfo(appinfo_file) File "D:Program Files (x86)Googlegoogle_appenginegoogleappengineapiappi nfo.py", line 1756, in LoadSingleAppInfo listener.Parse(app_info) File "D:Program Files (x86)Googlegoogle_appenginegoogleappengineapiyaml _listener.py", line 226, in Parse self._HandleEvents(self._GenerateEventParameters(stream, loader_class)) File "D:Program Files (x86)Googlegoogle_appenginegoogleappengineapiyaml _listener.py", line 172, in _HandleEvents for event in events: File "D:Program Files (x86)Googlegoogle_appenginegoogleappengineapiyaml _listener.py", line 212, in _GenerateEventParameters raise yaml_errors.EventListenerYAMLError(e) google.appengine.api.yaml_errors.EventListenerYAMLError: mapping values are not allowed here in "D:DropboxDropboxPython FilesUdacity Pythonblogblogmain.py", line 19 , column 42

This is a simple program that outputs one line. Here is the main.py file

import webapp2

class MainHandler(webapp2.RequestHandler): ***THIS is line 19, column 42 per the error above, I omitted the comments above it for clarity.

def get(self):
    self.response.write('Bloogggger')

app = webapp2.WSGIApplication([ ('/', MainHandler),('/', Blog, '/'),('/blog/', newpost ) ], debug=True)

Here is the app.yaml ***Its properly formatted and indented in the file, i can't get it to paste properly here

application: wpablog2014 version: 1 runtime: python27 api_version: 1 threadsafe: yes

handlers: - url: /favicon.ico

static_files: favicon.ico

upload: favicon.ico

  • url: .*

    script: main.app

libraries: - name: webapp2

version: "2.5.2"

raise yaml_errors.EventListenerYAMLError(e)

Your problem is on the app.yaml
file:

Your mistake
is here, the syntax is wrong. the -
goes to next line indented by 2 spaces:

handlers: - url: /favicon.ico #wrong
static_files: favicon.ico #wrong
upload: favicon.ico #wrong

url: .*
script: main.app#wrong
libraries: - name: webapp2 #very wrong
version: "2.5.2" #wrong

correct example:

libraries:
- name: jinja2
  version: latest

- name: webapp2
  version: latest

The syntaxt in the app.yaml file is strict. Please read here
about it's syntax and
here

for the app engine config.

Btw when having a problem try to read the logs for keywords. The log is your friend.

Hello, buddy!

责编内容by:Hello, buddy!阅读原文】。感谢您的支持!

您可能感兴趣的

Generating Laplace Distributed Random Values Differential privacy adds Laplace-distributed random noise to data to protect i...
Python快速实现分布式任务 深入读了读python的官方文档,发觉Python自带的multiprocessing模块有很多预制的接口可以方便的实现多个主机之间的通讯,进而实现典型的生产者...
使用Python以及C++简单绕过反爬虫机制 * 本文作者:我的gtr弹射起步,本文属FreeBuf原创奖励计划,未经许可禁止转载 0×00 某些网站有反爬虫的机制 对于刚学习了几天py...
Python 3.6.4 : Testing OpenCV default GrabCut algo... The main goal for me was to test the new install of python 3.6.4 and python modu...
我的自学Python之路(第二阶段Day3) 今天学习内容如下: 1.学习昨天练习题目的解题新方法1 #1、使用while循环输入 1 2 3 4 5 6 8 9 10 2 ''' ...