It's all about the answers!

Ask a question

How to attach a file in the report thanks to the CLA if I use a Python script ?

Paul-Ambroise Burdet (132) | asked Sep 10 '20, 6:06 a.m.

Hi everyone,

I am using the command line adapter of IBM to automate some process.

I put the python.exe (kernel) as the Command of the Adapter
And I put the Python script as the Argument.

Process works properly, but I am now trying to add a file to the Attachments in the Result Details. As I am not using a .bat or shell script, I did not find explanation on how to attach a file.

Has somebody the answer and could help me on how to attach a file thanks to a Python script?


Accepted answer

permanent link
Ralph Schoon (63.3k33646) | answered Sep 11 '20, 3:39 a.m.

My suggestion would be to write a basic batch file and  play with the feature first. See for how to attach files.

Once you understand the basics, call your python script from the command/batch file.

I experimented with this basic command batch:

echo Test
echo %*

set > c:\Temp\SetEnv.txt

echo SomeDocument=C:/shared/SomeDocument.txt >> %qm_AttachmentsFile%
echo SetEnv=c:/Temp/SetEnv.txt >> %qm_AttachmentsFile%
echo >> %qm_AttachmentsFile%
echo Google= >> %qm_AttachmentsFile%

echo CustomAttributesFile is %qm_CustomAttributesFile% > c:\Temp\Files.txt
echo CustomPropertiesFile is %qm_CustomPropertiesFile% >> c:\Temp\Files.txt
echo ExecutionVariableFile is %qm_ExecutionVariablesFile% >> c:\Temp\Files.txt
echo AttachmentsFile is %qm_AttachmentsFile% >> c:\Temp\Files.txt
echo Files=c:/Temp/Files.txt >> %qm_AttachmentsFile%

Paul-Ambroise Burdet selected this answer as the correct answer

Paul-Ambroise Burdet commented Sep 14 '20, 1:35 a.m.

This is what I was thinking to do

Thanks for your reply, I will give it a try!

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.