Skip to content

Instantly share code, notes, and snippets.

@bryik

bryik/README.md

Last active Jan 18, 2020
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

@michaelenglo michaelenglo 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

@RYuva RYuva commented Feb 2, 2018

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

@HideyukHira

This comment has been minimized.

Copy link

@HideyukHira HideyukHira commented Mar 2, 2018

Thanks for this tips.

@babatraore

This comment has been minimized.

Copy link

@babatraore babatraore commented Mar 7, 2018

Thanks, this was usefull

@skyler1253

This comment has been minimized.

Copy link

@skyler1253 skyler1253 commented Jun 19, 2018

This was incredibly useful. Thank you!

@JCarlosR

This comment has been minimized.

Copy link

@JCarlosR JCarlosR commented Apr 12, 2019

Thank you very much!

@hirocueki

This comment has been minimized.

Copy link

@hirocueki hirocueki commented May 24, 2019

Thank you 👍
This was helpful to me!

@james-n-007

This comment has been minimized.

Copy link

@james-n-007 james-n-007 commented Jan 18, 2020

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