Python Integration - VisualCron - Forum

Community forum

Nick Patten
2018-06-05T19:56:45Z
I have a python script I want to execute through visualcron. The issue is, the script involves the user passing parameters. Is it possible to give visualcron default parameters to pass once the script is run?
Support
2018-06-06T12:28:34Z
It is possible to pass parameters. I guess you simply use full path to python.exe in command in Execute Task and full path to script + parameters in argument field.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Nick Patten
2018-06-06T17:46:22Z
Are there any video tutorials that show me how to do this?
Support
2018-06-06T20:00:10Z
I think it is as simple as described:

1. use Execute Task
2. in command field use full path to python.exe on your computer, for example; c:\python\python.exe
3. in argument field use full path to your script then arguments, for example; c:\myscripts\script.py argument1 argument2

Let us know if this does not work.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Ankeet
2021-01-27T15:58:54Z
Thank you for the 3 steps above. For arguments, I need to pass dynamic dates. Is that possible? If not, I might be better off executing the python script manually.
Gary_W
2021-01-27T19:27:43Z
Sure, you can use program variables that are controlled in VC. Here's what arguments look like for one of our command calls where the VC job variable paths could contain a space and thus need to be surrounded by double quotes.

control=\"{JOB(Active|Variable|JobControlFile)}\" log=\"{JOB(Active|Variable|JobLogfile)}\"
Ankeet
2021-01-28T22:28:03Z
Based on the guidelines in below quoted message, all is set up. The VC job calls the proper script file and executes etc, but it always fails (error message below). When I execute the script.py from the server where VC is installed using Command Prompt, all works fine.

VC is installed on AppsProd server.
Script.py is on ScriptsFS file server.

On the VC job here are the command/params:
Command: C:\Program Files (x86)\Python37-32\Python.exe
Arguments: \\ScriptsFS\Public\Script.py

The job does execute, but fails with this error:
Traceback (most recent call last):
File " \\ScriptsFS\Public\Script.py", line 7, in <module>
import openpyxl
ModuleNotFoundError: No module named 'openpyxl'
Exception in Task: Non zero exit code
Exit code (1) description: Incorrect function.

On AppsProd, if I execute this, it works fine:
c:>\\ScriptsFS\Public\Script.py

Absolutely lost. Any help is appreciated!



Originally Posted by: Support 

I think it is as simple as described:

1. use Execute Task
2. in command field use full path to python.exe on your computer, for example; c:\python\python.exe
3. in argument field use full path to your script then arguments, for example; c:\myscripts\script.py argument1 argument2

Let us know if this does not work.



Support
2021-01-29T14:48:02Z
Originally Posted by: Ankeet 

Based on the guidelines in below quoted message, all is set up. The VC job calls the proper script file and executes etc, but it always fails (error message below). When I execute the script.py from the server where VC is installed using Command Prompt, all works fine.

VC is installed on AppsProd server.
Script.py is on ScriptsFS file server.

On the VC job here are the command/params:
Command: C:\Program Files (x86)\Python37-32\Python.exe
Arguments: \\ScriptsFS\Public\Script.py

The job does execute, but fails with this error:
Traceback (most recent call last):
File " \\ScriptsFS\Public\Script.py", line 7, in <module>
import openpyxl
ModuleNotFoundError: No module named 'openpyxl'
Exception in Task: Non zero exit code
Exit code (1) description: Incorrect function.

On AppsProd, if I execute this, it works fine:
c:>\\ScriptsFS\Public\Script.py

Absolutely lost. Any help is appreciated!



Originally Posted by: Support 

I think it is as simple as described:

1. use Execute Task
2. in command field use full path to python.exe on your computer, for example; c:\python\python.exe
3. in argument field use full path to your script then arguments, for example; c:\myscripts\script.py argument1 argument2

Let us know if this does not work.





Please send us an email to support@visualcron.com and include screenshots of your task settings as well as letting us know what version of VC you are using

Michael
Support
http://www.visualcron.com 

Please like  VisualCron on facebook!
Ankeet
2021-01-29T15:52:14Z
Email sent to support with subject line "Issue with Python (Post 40158)". Thank you for the follow up!
Support
2021-01-29T18:20:49Z
Issue has been resolved. The problem was that the path to python was using 32-bit exe. Change to 64-bit resolved the issue.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Users browsing this topic
Scroll to Top