Python pyinstaller不';t执行子进程命令

Python pyinstaller不';t执行子进程命令,python,Python,我在一个.py文件上运行了pyinstaller,除了一行通过subprocess命令调用另一个.py文件外,其他一切都正常。下面是我的.py文件的代码和子流程行: #!/usr/bin/env python # coding: utf-8 # In[ ]: import PySimpleGUI as sg import subprocess py_file_path = "C:\\Users\\PIN CM 5\\Documents\\Python_Scripts\\Master_Sc

我在一个.py文件上运行了pyinstaller,除了一行通过subprocess命令调用另一个.py文件外,其他一切都正常。下面是我的.py文件的代码和子流程行:

#!/usr/bin/env python
# coding: utf-8

# In[ ]:


import PySimpleGUI as sg
import subprocess

py_file_path = "C:\\Users\\PIN CM 5\\Documents\\Python_Scripts\\Master_Script_v2.py"
gif_file_path= "C:\\Users\\PIN CM 5\\Desktop\\Bryant\\Wait Gifs\monkey.gif"

layout = [[sg.Text('Choose Report')],
      [sg.Listbox(values=('Industry Review (all)', 'Kia_IP', 'Hyundai_IP', 'Mitsu_IP','Acura_IR', 'Honda_IR', 'Hyundai_IR', 'Kia_IR', 'Mazda_IR','Mitsu_IR'), size=(40, 5))],
      [sg.Text('[Required] Enter report date (YYYYMM):'), sg.InputText()],
      [sg.Text('Refresh Cube?'), sg.Combo(['Yes', 'No'], default_value = 'No')],
      [sg.Text('Month-end or MTD?'), sg.Combo(['Month-end', 'MTD'], default_value = 'MTD')],
      [sg.Text('[MTD] Enter share data through (YYYYMMDD):'), sg.InputText()],
      [sg.Text('[MTD] Enter spend data through (YYYYMMDD):'), sg.InputText()],
      [sg.Text('[MTD] Enter month-end forecast (no commas):'), sg.InputText()],
      [sg.OK(), sg.Cancel()]]

window = sg.Window('Create Decks', layout)

while True:
event, values = window.Read()
inputs_list = ['report_name', 'report_date', 'refresh_cube', 'monthend_or_MTD', 'share_date', 'spend_date', 'forecast']
inputs_dict = {}
for i, input in enumerate(inputs_list):
    if i == 0:
        inputs_dict[input] = values[i][i]
    elif values[i] == '':
        inputs_dict[input] = "0"
    else:
        inputs_dict[input] = values[i]
if event is None or event == 'Exit' or event == 'Cancel':
    break
else:
    sg.PopupAnimated(gif_file_path, message='Just a sec...', background_color='#FFF', font=("Helvetica",18), keep_on_top=True)     
    subprocess.call(['python', py_file_path , inputs_dict['report_name'], inputs_dict['report_date'], inputs_dict['refresh_cube'], inputs_dict['monthend_or_MTD'], inputs_dict['share_date'], inputs_dict['spend_date'], inputs_dict['forecast']])
    sg.PopupAnimated(image_source=None)
    sg.Popup("Complete.\nPlease go to Desktop -> Monthly Automation -> Output", keep_on_top=True)
window.Close()


# In[ ]:
我在命令提示符下运行了此命令,它执行得很好:

python "C:\\Users\\PIN CM 5\\Documents\\Python_Scripts\\Master_Script_v2.py" Kia_IP 201909 No Month-end 0 0 0

这个问题是在我将流程迁移到一台新计算机后出现的(旧的计算机有用户“PIN”,而新的计算机是“PIN CM 5”,但我相信添加引号应该解决这个问题)。非常感谢您的帮助。

尝试在目标PC上的python shell中运行
p=call([…])
您的命令,看看
p
等于什么-它应该是一个元组,第二项是0或1。这就是出口代码到底发生了什么?它崩溃了吗?@Legoroj当我运行p=subprocess.call([…])时,我在p上得到一个整数类型。这意味着什么?@RobertKearns没有崩溃-它完成了执行,我在脚本末尾得到了弹出窗口“Complete…”。它的值是多少?这是退出代码-0表示正确,1表示在目标PC上的python shell中运行failTry
p=call([…])
您的命令,看看
p
等于什么-它应该是一个元组,第二项是0或1。这就是出口代码到底发生了什么?它崩溃了吗?@Legoroj当我运行p=subprocess.call([…])时,我在p上得到一个整数类型。这意味着什么?@RobertKearns没有崩溃-它完成了执行,我在脚本末尾得到了弹出窗口“Complete…”。它的值是多少?这是退出代码-0表示良好,1表示失败