簡體   English   中英

在Python 2.7上在后台執行游戲

[英]Execute Gams in background on Python 2.7

我需要從Python腳本在后台調用和運行gams。

我正在使用:

import subprocess
subprocess.check_call([r"C:\GAMS\win64\24.4\gams.exe",r"F:\Otim\Interface\ElGr.gms"])

它給了我這個錯誤:

追溯(最近一次通話):文件“ F:/Otim/Interface/tent_backgroundgams.py”,行91,位於subprocess.check_call([r“ C:\\ GAMS \\ win64 \\ 24.4 \\ gams.exe”,r“ F :\\ Otim \\ Interface \\ ElGrs。gms“])文件” C:\\ Python27 \\ ArcGIS10.2 \\ lib \\ subprocess.py“,第511行,在check_call中引發CalledProcessError(retcode,cmd)CalledProcessError:命令'['C: \\ GAMS \\ win64 \\ 24.4 \\ gams.exe','F:\\ Otim \\ Interface \\ ElGr。 gms']'返回了非零退出狀態6

我該如何解決?

以下是不同退出代碼的含義的列表: https : //www.gams.com/help/index.jsp?topic=%2Fgams.doc%2Fuserguides%2Fuserguide%2F_u_g__g_a_m_s_return_codes.html

因此,6表示“存在參數錯誤”(因為找不到帶有多余空格的指定文件)。 3表示“存在執行錯誤”。 因此,GAMS運行模型時出現了一些錯誤。 默認情況下,您應該在工作副本中找到一個lst文件(ElGrs.lst)。 如果在該文件中搜索“ ****”,則應該查看出了什么問題以及錯誤出現的位置。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM