Skip to content

Instantly share code, notes, and snippets.

@bryik bryik/README.md
Last active Jun 10, 2019

Embed
What would you like to do?
`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

This comment has been minimized.

Copy link

commented Nov 10, 2017

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

This comment has been minimized.

Copy link

commented Feb 2, 2018

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

@HideyukHira

This comment has been minimized.

Copy link

commented Mar 2, 2018

Thanks for this tips.

@babatraore

This comment has been minimized.

Copy link

commented Mar 7, 2018

Thanks, this was usefull

@skyler1253

This comment has been minimized.

Copy link

commented Jun 19, 2018

This was incredibly useful. Thank you!

@JCarlosR

This comment has been minimized.

Copy link

commented Apr 12, 2019

Thank you very much!

@hirocueki

This comment has been minimized.

Copy link

commented May 24, 2019

Thank you 👍
This was helpful to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.