【问题标题】:Pass Argument to Python Script in Windows Command Prompt在 Windows 命令提示符中将参数传递给 Python 脚本
【发布时间】:2016-08-04 13:36:35
【问题描述】:

我正在尝试通过 windows 命令提示符将参数传递给 python,但遇到以下错误:

[Errno 22] Invalid argument

命令提示符代码:

C:\Python27\python.exe "C:\Users\Apples\Documents\ArcGIS\Grapes\Blueberry_Cobbler\recipe.py C:\Users\Apples\Documents\ArcGIS\Grapes\Blueberry_Cobbler\input1.txt"

【问题讨论】:

  • 试试C:\Python27\python.exe "C:\Users\Apples\Documents\ArcGIS\Grapes\Blueberry_Cobbler\recipe.py" "C:\Users\Apples\Documents\ArcGIS\Grapes\Blueberry_Cobbler\input1.txt"
  • 感谢您的回复,遗憾的是这不起作用,仍然抛出错误。
  • 您需要@iwin 建议的引号。如果您仍然遇到错误,请编辑您的问题以包含完整的回溯。
  • 谢谢大家,发现错误是因为python.exe文件丢失了一个文件夹。数字......

标签: python windows parameter-passing command-prompt arcpy


【解决方案1】:

您缺少" 的结束和开始:

C:\Python27\python.exe 
"C:\Users\Apples\Documents\ArcGIS\Grapes\Blueberry_Cobbler\recipe.py" 
"C:\Users\Apples\Documents\ArcGIS\Grapes\Blueberry_Cobbler\input1.txt"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-05-20
    • 2019-08-24
    • 2018-10-16
    • 2012-10-05
    • 2014-03-08
    • 2013-10-22
    • 2016-12-19
    相关资源
    最近更新 更多