Execute Process Task - Python Script

  • I'm having the following error when executing a python script manually via VS. 

    [Execute Process Task] Error: In Executing "python.exe" "'f:/segment.py"" at "", The process exit code was "2" while the expected was "0".

    However I can successfully run the script manually in cmd if I copy/paste the code above.  Has anyone experienced this issue?

  • Your file path appears to start with a single quote and end with a double quote: was that deliberate?

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Ah that was just a mistype on my part when I shortened the path to show on the forum.  I do have double quotes on both ends.

  • Aubrey-314204 - Monday, April 10, 2017 12:48 PM

    Ah that was just a mistype on my part when I shortened the path to show on the forum.  I do have double quotes on both ends.

    OK, are you getting this error in SSDT, or only when running through SQL Agent?
    Is the Python file on a local drive, or mapped to network drive?

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Did the task actually do what it performed? I note that you have your success exit code set to 0, so SSIS see a 2 as a failure. If so, perhaps 2 is the correct exit code, and thus your task should represent that? Or your could set your task to ignore the exit code completely (but then you should have some other method of checking success).

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

  • I get this error in SSDT and the python script is on a local drive. 
    The task fails immediately and does not perform the task.  The python code is exiting with the correct success code.

  • Phil Parkin - Monday, April 10, 2017 12:55 PM

    Aubrey-314204 - Monday, April 10, 2017 12:48 PM

    Ah that was just a mistype on my part when I shortened the path to show on the forum.  I do have double quotes on both ends.

    OK, are you getting this error in SSDT, or only when running through SQL Agent?
    Is the Python file on a local drive, or mapped to network drive?

    I get this error in SSDT and the python script is on a local drive.

  • Aubrey-314204 - Monday, April 10, 2017 1:26 PM

    Phil Parkin - Monday, April 10, 2017 12:55 PM

    Aubrey-314204 - Monday, April 10, 2017 12:48 PM

    Ah that was just a mistype on my part when I shortened the path to show on the forum.  I do have double quotes on both ends.

    OK, are you getting this error in SSDT, or only when running through SQL Agent?
    Is the Python file on a local drive, or mapped to network drive?

    I get this error in SSDT and the python script is on a local drive.

    Please try creating a .BAT file which executes successfully outside of SSIS and then changing your EP task so that it runs that.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Phil Parkin - Monday, April 10, 2017 1:32 PM

    Aubrey-314204 - Monday, April 10, 2017 1:26 PM

    Phil Parkin - Monday, April 10, 2017 12:55 PM

    Aubrey-314204 - Monday, April 10, 2017 12:48 PM

    Ah that was just a mistype on my part when I shortened the path to show on the forum.  I do have double quotes on both ends.

    OK, are you getting this error in SSDT, or only when running through SQL Agent?
    Is the Python file on a local drive, or mapped to network drive?

    I get this error in SSDT and the python script is on a local drive.

    Please try creating a .BAT file which executes successfully outside of SSIS and then changing your EP task so that it runs that.

    Thank you for the BAT file suggestion.  I was able to pause that and see the real problem.  It did not like the underscore I was using in the python script name.  I did not think that could be an issue.

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply