Skip to content Skip to sidebar Skip to footer

Ssis Execute Process Task For Python Script To Api With Oauth2 - Access Denied To The File With Saved Token

I have strange problem and don't know what to check further. Summary of the situation: working on the Windows Server 2016 as administrator, so should not have any access problems

Solution 1:

I found the problem. And it was related with the properties of Execute Process Task step of SSIS Package...

As I noticed above, I executed Python script by .bat file with the command inside: C:\Python27\python.exe C:\BI\API\Python_GoogleAnalytics_Reporting\v3_api_analytics\google_analytics_api_v3_10krows_nosampling_multiple_profiles.py. Execution of the .bat itself worked fine, but execution of the same .bat from SSIS Package as Execute Process Task step - returns the errors above.

In the logs of errors in the beginning we see:

C:\Program Files (x86)\Microsoft SQL Server\110\DTS\binn> C:\Python27\python.exe C:\BI\API\Python_GoogleAnalytics_Reporting\v3_api_analytics\google_analytics_api_v3_10krows_nosampling_multiple_profiles.py

C:\Python27\lib\site-packages\oauth2client_helpers.py:260: UserWarning: Cannot access analytics.dat: No such file or directory

warnings.warn(_MISSING_FILE_MESSAGE.format(filename))

What says initially, that there is no file analytics.dat in the working folder of script. But I expected, that script executes in the same folder where it is located and there already had existed file C:\BI\API\Python_GoogleAnalytics_Reporting\v3_api_analytics\analytics.dat

But then I noticed, that on the first place in that message (I marked it as bold) is working folder of the external script execution, script starts in the SSIS folder.

I found, that when the process is launched from SSIS, it's not being run from the same folder as the executable .bat file located. What is different from the direct .bat file execution.

So, it is necessary additionally specify working folder property of Execute Process Task step of SSIS Package.

I set such property value:

Working directory:C:\BI\API\Python_GoogleAnalytics_Reporting\v3_api_analytics\enter image description here

And everything works fine!

Post a Comment for "Ssis Execute Process Task For Python Script To Api With Oauth2 - Access Denied To The File With Saved Token"