SSIS 执行流程任务 Python 脚本 [英] SSIS Execute Process Task Python script

查看:26
本文介绍了SSIS 执行流程任务 Python 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 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:Python27python.exe" "C:Userslalalbalagender-guesser-0.4.0	estgenderTest.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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆