Python script not running in SSIS package - python

I have python script running from SSIS package.
I am running python script in ".bat" file.
If I Execute SSIS package, it is running fine. Same package if I deploy and run/scheduled run it is failing with below error:
error: In Executing "D:/SSIS/PYTHON_SCRIPT/task.bat "D:/SSIS/PYTHON_SCRIPT/". The process exit code was "1" while the expected was "0"
Any one have similar issue. Help me to solve this.

Make sure your Python Libraries are correctly configured and check Environment Variables as well

Related

Python cannot install graphql

I tried to run a python script on my local machine. Apparently this script stops and throws an error with message "no named module graphql". I tried to do python -m pip install graphql and it also fails with error message "Don't know how to compile graphql/graphql_ext.pyx". A screenshot of the entire error is shown below.
The script and commands are ran with the PowerShell
I use a windows machine
I use Python version "3.10.7"

Python Jira module is not found, but it's installed

I have two files - one PHP file and one Python file. The python file imports the Jira module, searches for issues, and obtains information from Jira. This file does function correctly and it will find Jira issues and return all needed fields successfully.
The PHP file (for this example, let's call it py_exec.php) is part of a website and executes the Python file through shell_exec; something to the effect of:
$jira_issues = shell_exec(python3 py_search.py issue=blah);
print_r($jira_issues);
When I run the Python script directly, the script works correctly.
When I execute the PHP script directly, which in turn executes the Python script, the script works correctly.
But when I run the PHP script from the website, the script returns nothing.
After troubleshooting a bit, I tried to run the command as the apache user and I am given the following error:
ModuleNotFoundError: No module named 'jira'
Obviously the module is installed, but it seems that it's not accessible to Apache.
How do I make this module accessible to Apache?
Many thanks, in advance, for any help I can get.
su to the apache user and run pip install jira. Check that it worked by doing python and then import jira.
Sometimes pip ends up aliased to something other than python. So if you have issues, try python -m pip instead.

py-spy: how to run scripts with dependencies?

running the following on windows 10
C:\code\EPMD\Kodex-1.4.6\EPD_Prerequisite\Anaconda2\Scripts/py-spy.exe --nonblocking -- python C:\code\EPMD\Kodex-1.4.6\Applications\EPMD-Software\Preprocessor/Main.py
gives
import error, no module named <>
even though the script Main.py is running fine.
How do I make py-spy recognize imports?
This should just work. Can you create an issue on github?
As a work around, you can run the program yourself and get py-spy to profile it by passing the PID.

Automatically execute Sphinx on Python script using Jenkins

I have been trying to create a Jenkins job that automatically executes a python script and launch its documentation via Sphinx.
The execution part works well but I'm not able to do the Sphinx part. My first idea was to create an 'Execute Windows Script bash' step inside the Jenkins job with make html command after going to the right directory with cd. But I keep on getting this error:
make is not recognized as an internal or external command
Same idea works when I do it from the CMD tool.
I already added the PATH variable in Jenkins settings with System32 folder.
System Information:
OS: Windows
Arch: x64
I figured out, I just had to put the following inside my Windows Shell Job:
call "Path\To\make.bat"

python can't find libraries if run from incron

I have a python script that processes excel files. I this script is run via python from the command line, it runs as expected but when I run from incron, it does't appear to see my imports, such as pandas
this is how I call from incron:
file/to/monitor IN_CREATE,IN_MOVED_TO /usr/bin/sh /my/main/shell/script
this is how my script looks like
#!/usr/bin/env python
source activate my_env
python /absolute/path/to/python/script
and now as I check on the logs, from abrt,
step1.1_executeConsolidation.py:2::ImportError: No module named pandas
I'm thinking this is just an environment issue with incron, but I'm not sure how to set it up properly.
I use anaconda by the way. If run manually, I don't have any library dependency issues

Categories

Resources