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!阅读原文】。感谢您的支持!

您可能感兴趣的

Create an exponential decay list with a predetermi... how to create a drop-down list with watermark text inside In HTML how do you create...
Advanced Ren’Py: Part 4: Text and Button Working with Ren’Py: Part 1: Downloading and Configuring Part 2: Editing and Creating Characters P...
用Python分析豆瓣电影TOP250 既然要分析豆瓣电影TOP250, 那么肯定就要把相关的数据采集下来,比如排名、电影名、导演、主演等信息。 那就肯定使用一下爬虫咯,如果还不会的话,欢迎看之前的文章: Python爬虫学习(一)概...
Manticore: Symbolic execution for humans Earlier this week, we open-sourced a tool we rely on for dynamic binary analysis: Manticore ! Manticore helps us qui...
Python从菜鸟到高手(6):获取用户输入、函数与注释... 1. 获取用户输入 要编写一个有实际价值的程序,就需要与用户交互。当然,与用户交互有很多方法,例如,GUI(图形用户接口)就是一种非常好的与用户交互的方式,不过我们先不讨论GUI的交互方式,本节会采用一种原始,但很有效的方式与用户交互...