Skip to content

Instantly share code, notes, and snippets.

@bryik
Last active January 18, 2020 17:15
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryik/1f507969f5239625628d6b63f04eae60 to your computer and use it in GitHub Desktop.
Save bryik/1f507969f5239625628d6b63f04eae60 to your computer and use it in GitHub Desktop.
`dev_appserver.py: error: too few arguments`

2017-07-16

dev_appserver.py: error: too few arguments

I encountered this error shortly after installing the Google Cloud SDK. It made no sense, I was in the correct directory and entered the same command as usual:

dev_appserver.py app.yaml

But it didn't work!?

Solution

To keep things short, I'll leave out the stuff I tried but didn't work (e.g. editing the path). I came upon this SO answer, initially I ignored it because it had 0 points and the previous answers hadn't helped but it held the key all along!

Just like pathrik, I had gotten to the point of adding print statements to dev_appserver.py to see what was going on. Adding print("SYS ARG:", sys.argv) to the top of the main() method demonstrated that (for whatever reason) Windows was not passing along arguments to Python; I expected to see "app.yaml" but it was not printed when I ran dev_appserver.py app.yaml.

Steps to fix:

  1. Open the registry editor by typing "regedit" in the Windows search bar.

  2. Navigate to the correct entry by pasting Computer\HKEY_CLASSES_ROOT\Applications\python.exe\shell\open\command into the address bar.

  3. Edit, modify (an "Edit String" modal should pop open).

  4. Add %* to the "Value data:" field. Various stackoverflow users have reported slightly different values for this and I had to experiment a bit to get it right. My complete value field:

"C:\Users\Ben\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\bundledpython\python.exe" "%1" %*

Yours will be different if you don't use Cloud SDK's bundled Python.

@michaelenglo
Copy link

Hey, thanks for the gist.

I just uninstalled and reinstalled google cloud SDK and I encountered this problem too.

I was trying to follow the steps to fix but it seems like the steps have already been satisfied even without me doing anything.

in the value data, I already have this:

"C:\Python27\python.exe" "%1" %* (I installed python for all users).

Any idea why it's still not working?

@RYuva
Copy link

RYuva commented Feb 2, 2018

Thanks for the tips, bryik, this helped me solve this issue

@HideyukHira
Copy link

Thanks for this tips.

@babatraore
Copy link

Thanks, this was usefull

@skyler1253
Copy link

This was incredibly useful. Thank you!

@JCarlosR
Copy link

Thank you very much!

@uekkie
Copy link

uekkie commented May 24, 2019

Thank you 👍
This was helpful to me!

@james-n-007
Copy link

hey,someone help me i dont have "python.exe" at that path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment