Google Cloud构建错误“print_env_info.py:错误:无法识别的参数” [英] Google Cloud build error "print_env_info.py: error: unrecognized arguments"
问题描述
我试图在Windows(64位)计算机上启动并运行Google Cloud开发环境。
我在 https://console.developers.google.com/start/appengine ,但在步骤6(创建您的项目并部署)我收到了以下错误消息:
D:\ google-app-engine \appengine -try-java> appcfg.cmd -A
midyear-tempo-554 update t arget \appengine-try-java用法:
print_env_info.py [-h] item print_env_info.py:error:unrecognized
参数:Osofsky \AppData\Roaming\gcloud \tmp-env-info-10521.txt
我能够完成所有其他步骤。唯一的异常是在步骤4(在本地运行您的应用程序),当我尝试运行install.bat时出现以下错误:
<要使用Google Cloud SDK,您必须安装Python并在
PATH上安装。或者,您也可以将CLOUDSDK_PYTHON
环境变量设置为您的Python可执行文件的位置。这个问题通过在install.bat中添加以下行:set CLOUDSDK_PYTHON = C:\Python27\python.exe
我不确定这是否导致
print_env_info.py:error:unrecognized参数
,但它似乎相关,因为它们都与环境变量有关。因此,我在我的用户级环境变量中添加了CLOUDSDK_PYTHON = C:\ Python27 \python.exe
。然后我启动了一个新的命令提示符,通过set
命令确认CLOUDSDK_PYTHON = C:\ Python27 \python.exe
已经注册,然后再次尝试,但仍然出现此错误:
lockquote
D:\ google-app-engine \ appengine-try-java> appcfg.cmd -A
midyear-tempo-554 update t arget\appengine-try-java用法:
print_env_info.py [-h] item print_env_info.py:error:无法识别的
参数:Osofsky\AppData\Roaming\gcloud\tmp-env-info-8445.txt
任何想法?
来自Google Enterprise Support的一位名为Jordan的代表给我下面修改的appcfg.cmd文件。它帮助我度过了我遇到的错误。不幸的是,现在还有一个问题,但我认为下面的解决方案解决了我发布的原始错误。感谢Heeryu和Tatiana提供的帮助。
@echo off
rem版权所有2013 Google Inc.保留所有权利。
cmd / cpython%〜dp0bootstrapping \ prerun.py--command-name = appcfg -java --component-id = gae-java - -check-credentials --check-updates
IF%ERRORLEVEL%NEQ 0(
EXIT / B%ERRORLEVEL%
)
SETLOCAL
set TMPFILE =%APPDATA%\gcloud\tmp-env-info-%RANDOM %.txt
cmd / cpython%〜dp0bootstrapping\print_env_info.pygae_java_path>%TMPFILE%
IF%ERRORLEVEL%NEQ 0(
EXIT / B%ERRORLEVEL%
)
set / p凭证路径=<%TMPFILE%
del%TMPFILE%
cmd / c%〜dp0..\\ platform / appengine-java-sdk\bin\appcfg.cmd--oauth2 --oauth2_config_file =%credential_path%%*
IF%ERRORLEVEL%NEQ 0(
EXIT / B%ERRORLEVEL%
)
ENDLOCAL
I'm trying to get a Google Cloud development environment up and running on my Windows (64 bit) computer.
I followed instructions for Java at https://console.developers.google.com/start/appengine on my Windows computer but on step 6 ("Create Your Project and Deploy") I got this error message:
D:\google-app-engine\appengine-try-java>appcfg.cmd -A midyear-tempo-554 update t arget\appengine-try-java usage: print_env_info.py [-h] item print_env_info.py: error: unrecognized arguments: Osofsky\AppData\Roaming\gcloud \tmp-env-info-10521.txt
I was able to complete all the other steps. The only anomaly was in Step 4 ("Run Your App Locally") where I got the following error when I tried to run install.bat:
To use the Google Cloud SDK, you must have Python installed and on your PATH. As an alternative, you may also set the CLOUDSDK_PYTHON environment variable to the location of your Python executable.
I successfully solved this problem by adding the following line to install.bat:
set CLOUDSDK_PYTHON=C:\Python27\python.exe
I wasn't sure if this caused "print_env_info.py: error: unrecognized arguments"
, but it seems related because they both have to do with environment variables. So I added CLOUDSDK_PYTHON=C:\Python27\python.exe
to my user-level environment variables. I then started a new command prompt, confirmed via a "set"
command that CLOUDSDK_PYTHON=C:\Python27\python.exe
had registered, and tried again but I still got this error:
D:\google-app-engine\appengine-try-java>appcfg.cmd -A midyear-tempo-554 update t arget\appengine-try-java usage: print_env_info.py [-h] item print_env_info.py: error: unrecognized arguments: Osofsky\AppData\Roaming\gcloud \tmp-env-info-8445.txt
Any ideas?
A representative from Google Enterprise Support named Jordan gave me the revised appcfg.cmd file below. It helped get me past the error I was having. Unfortunately there's another issue now, but I think the solution below addresses the original error I posted about. Thanks Heeryu and Tatiana for your offers of help.
@echo off
rem Copyright 2013 Google Inc. All Rights Reserved.
cmd /c "python "%~dp0bootstrapping\prerun.py" --command-name=appcfg-java --component-id=gae-java --check-credentials --check-updates"
IF %ERRORLEVEL% NEQ 0 (
EXIT /B %ERRORLEVEL%
)
SETLOCAL
set TMPFILE=%APPDATA%\gcloud\tmp-env-info-%RANDOM%.txt
cmd /c "python "%~dp0bootstrapping\print_env_info.py" gae_java_path > "%TMPFILE%"
IF %ERRORLEVEL% NEQ 0 (
EXIT /B %ERRORLEVEL%
)
set /p credential_path= < "%TMPFILE%"
del "%TMPFILE%"
cmd /c ""%~dp0..\platform/appengine-java-sdk\bin\appcfg.cmd" --oauth2 --oauth2_config_file="%credential_path%" %*"
IF %ERRORLEVEL% NEQ 0 (
EXIT /B %ERRORLEVEL%
)
ENDLOCAL
这篇关于Google Cloud构建错误“print_env_info.py:错误:无法识别的参数”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!