I am trying to run appcfg.py from CMD. instead of

2019-01-29 01:49发布

问题:

I installed python 2.7.13 and the google original App Engine SDK for PHP. I created my first project on google console and When I am trying to deploy the project file from cmd using

appcfg.py -A *project-id* update *project-folder*

Instead of running, its just being edited in chrome. Please refer attached picture chrome editing appcfg.py

回答1:

you are probably running Windows and have probably wrongly associated your .py files with Google Chrome (like it is associated to .html files)

Chrome acts as a text viewer in that case.

Either reinstall python (to fix associations, that would be the best thing to do, python has a "repair" option when running the installation, no need to uninstall/reinstall) or remove your user registry key:

[HKEY_CLASSES_ROOT\Python.File\shell\open\command]

which must contain something wrong like:

@="\"C:\\Programs\\chrome.exe\" \"%1\"

and let system file associations take over.

or as a final workaround, if you cannot, just use python prefix to force python execution instead of relying on file associations:

python appcfg.py -A *project-id* update *project-folder*

(python must be in the path, and appcfg.py must be in the current directory or in PYTHONPATH)

note that the shebang #!/usr/bin/python doesn't help here (on Linux it would have helped)