GAE Python : dev_appserver.py: error: too few arguments

GAE Python : dev_appserver.py: error: too few arguments

I think I have found the real problem behind this error.

Tried putting some print statements in the dev_appserver.py file and found that what ever argument we are giving is not being passed and hence the error. On googling came across this SO post which explains the problem. On doing that change the following command worked flawlessly 😀

dev_appserver.py app.yaml

Quoting that SO answer for easier reference:

I think I solved this. For some reason there is a SECOND place in the registry (besides that shown by the file associations stored in HKEY_CLASSES_ROOTPython.Fileshellopencommand):

[HKEY_CLASSES_ROOTApplicationspython.exeshellopencommand]
@=C:\Python25\python.exe %1 %*

This seems to be the controlling setting on my system. The registry setting above adds the %* to pass all arguments to python.exe (it was missing in my registry for some reason).

You just need to execute the dev_appserver.py with path to app.yaml in the command itself, as suggested in comments.

GAE Python : dev_appserver.py: error: too few arguments

I think OP couldve identified a potential issue when describing multiple Python installations.

If I dont specify which Python installation (I thought I only had one…), then, it fails:

C:Python27>C:Program Files (x86)GoogleCloud SDKgoogle-cloud-sdkbindev_appserver.py C:usersjessminedocumentsttbtamerapp.yaml
usage: dev_appserver.py [-h] [-A APP_ID] [--host HOST] [--port PORT]
...etc...
dev_appserver.py: error: too few arguments

But if I specify which Python to use by invoking Python first, @ C:Python27python.exe, then it works:

C:Python27>C:Python27python.exe C:Program Files (x86)GoogleCloud SDKgoogle-cloud-sdkbindev_appserver.py C:usersjessminedocumentsttbtamerapp.yaml
INFO     2016-11-18 10:09:14,299 devappserver2.py:769] Skipping SDK update check.

Anyway since I dont think I have other Python installations on my computer, then I may be misinterpreting the difference here. But for me, the fix is to explicitly invoke python.exe.

(And to be clear, I know about putting the Python.exe location into %PATH%, but I expected that if it wasnt there, that the error wouldve been something like dev_appserver.py is not recognized as an internal or external command, rather than executing and printing a Python error….)

EDIT

After changing the associate a file type or protocol with a specific program (example here) for *.py to explicitly use C:Python27python.exe , then I no longer needed to manually invoke C:Python27python.exe in my cmd; i.e. my first example worked correctly :

C:Program Files (x86)GoogleCloud SDKgoogle-cloud-sdkbin>dev_appserver.py C:usersjessminedocumentsttbtamerapp.yaml
INFO     2016-11-18 10:33:50,269 devappserver2.py:769] Skipping SDK update check.

Related Posts

Leave a Reply

Your email address will not be published.