SSIS执行流程任务Python脚本 [英] SSIS Execute Process Task Python script
问题描述
我正在尝试从SSIS执行过程任务中执行python脚本。我遵循了所有有关如何执行此操作的教程,但脚本从一开始就失败了。当我从SSIS执行python脚本时,它运行完美。
I'm trying to execute a python scrip from SSIS Execute Process Task. I followed all the tutorials of how to do this an still the script is failing from the start. when i execute the python script out of SSIS it runs perfectly.
这是我的Python脚本:
This is my Python scrip:
import sys
import gender_guesser.detector as gender
import xml.etree.cElementTree as ET
from xml.etree.ElementTree import ParseError
try:
input("Press Enter to continue...")
except SyntaxError:
pass
tree = ET.parse('user.xml')
root = tree.getroot()
for child_of_root in root:
for attr in child_of_root:
if attr.tag == 'first_name':
upperName = "%s%s" % (attr.text[0].upper(), attr.text[1:])
print attr.tag,upperName
d = gender.Detector()
gen = d.get_gender(upperName)
print gen
attr.text= gen
tree = ET.ElementTree(root)
tree.write("user1.xml")
这是SSIS执行过程任务的图像:
this is an image of the SSIS Execute Process Task:
错误消息:
[Execute Process Task] Error:
In Executing "C:\Python27\python.exe" "C:\Users\bla\blalba\bla\gender-guesser-0.4.0\test\genderTest.py " at "", The process exit code was "1" while the expected was "0".
推荐答案
Python的文件路径中是否有空格脚本?尝试传递带有空格的路径作为执行脚本过程中的参数时,我遇到了相同的错误。解决方案是在引号中输入引号。
Did you have spaces in your file path to your python script? I had the same error when trying to pass a path with spaces as my argument in Execute Script Process. The resolution was to enter the argument with quotes.
这篇关于SSIS执行流程任务Python脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!