<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: [resolved] Execute python script using tSystem in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/resolved-Execute-python-script-using-tSystem/m-p/2219421#M14234</link>
    <description>Can can you share your Python script?&amp;nbsp;
&lt;BR /&gt;It may be writing the output to the Talend job's current directory rather than where you expect it to be .&amp;nbsp;
&lt;BR /&gt;It might also not be reading the File based on the way the parameters are passed to the CMD</description>
    <pubDate>Sun, 28 Feb 2016 18:04:34 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-02-28T18:04:34Z</dc:date>
    <item>
      <title>[resolved] Execute python script using tSystem</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Execute-python-script-using-tSystem/m-p/2219420#M14233</link>
      <description>Hello,&lt;BR /&gt;I'm trying to execute a python script in Talend.&lt;BR /&gt;I just put a tSystem on my job and fill the 'command' field by : "cmd /c C:/Python24/python.exe Q:/Python/Test/myScript.py"&lt;BR /&gt;The script is supposed to read files, create 2 others one. All the files the script uses (or writes) are in the same folder than the script. Outside Talend, the script works well.&lt;BR /&gt;But when I run the job, my script doesn't work. I have the 'prints' on the console inside Talend, but the files are not detected and the others are not written.&lt;BR /&gt;Any idea to help me ?&lt;BR /&gt;Thank you !</description>
      <pubDate>Sat, 16 Nov 2024 10:46:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Execute-python-script-using-tSystem/m-p/2219420#M14233</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2024-11-16T10:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Execute python script using tSystem</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Execute-python-script-using-tSystem/m-p/2219421#M14234</link>
      <description>Can can you share your Python script?&amp;nbsp;
&lt;BR /&gt;It may be writing the output to the Talend job's current directory rather than where you expect it to be .&amp;nbsp;
&lt;BR /&gt;It might also not be reading the File based on the way the parameters are passed to the CMD</description>
      <pubDate>Sun, 28 Feb 2016 18:04:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Execute-python-script-using-tSystem/m-p/2219421#M14234</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-02-28T18:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Execute python script using tSystem</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Execute-python-script-using-tSystem/m-p/2219422#M14235</link>
      <description>Hi, 
&lt;BR /&gt;Thank you for your answer. 
&lt;BR /&gt;Sadly, I can't share the script. 
&lt;BR /&gt;But here is the structure : 
&lt;BR /&gt; 
&lt;PRE&gt;from glob import glob&lt;BR /&gt;for file in glob("*.csv"):&lt;BR /&gt;    infile = open( file, 'r' )&lt;BR /&gt;    lines = infile.readlines()&lt;BR /&gt;    infile.close()&lt;BR /&gt;    for line in lines:&lt;BR /&gt;        // read the data&lt;BR /&gt;        // operations on data, result stored in a list&lt;BR /&gt;&lt;BR /&gt;outfile = open( outputFileName , 'w' )&lt;BR /&gt;for outputLine in list:&lt;BR /&gt;    outfile.write(outputLine) &lt;BR /&gt;outfile.close()&lt;/PRE&gt; 
&lt;BR /&gt;I checked the Talend job's current directory, nothing inside. 
&lt;BR /&gt;But actually you're right, none of the files are read.</description>
      <pubDate>Mon, 29 Feb 2016 13:12:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Execute-python-script-using-tSystem/m-p/2219422#M14235</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-02-29T13:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Execute python script using tSystem</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Execute-python-script-using-tSystem/m-p/2219423#M14236</link>
      <description>The script appears to make an assumption that the CSV files are in the current directory, based on the glob statement . For an easy mod, just specify an absolute path to glob ex 
&lt;BR /&gt;glob("/data/20160229/*.csv") 
&lt;BR /&gt;&amp;nbsp;You could also add some debugging output lines &amp;nbsp;For help in troubleshoouting&amp;nbsp; 
&lt;BR /&gt;&amp;nbsp;It's files might sometimes be in a different folder, then you can look at ways to perm parameterize The script or add a configuration file</description>
      <pubDate>Mon, 29 Feb 2016 16:58:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Execute-python-script-using-tSystem/m-p/2219423#M14236</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-02-29T16:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Execute python script using tSystem</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Execute-python-script-using-tSystem/m-p/2219424#M14237</link>
      <description>&amp;nbsp;Of course, &amp;nbsp;I should ask…&amp;nbsp;&lt;BR /&gt;Why not use Talend components for your task? It is very easy to list files , read CSV files, transform, and write the files out in a different format</description>
      <pubDate>Mon, 29 Feb 2016 17:03:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Execute-python-script-using-tSystem/m-p/2219424#M14237</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-02-29T17:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: [resolved] Execute python script using tSystem</title>
      <link>https://community.qlik.com/t5/Talend-Studio/resolved-Execute-python-script-using-tSystem/m-p/2219425#M14238</link>
      <description>I specified the absolute path to glob, and it seems it's working ! 
&lt;BR /&gt;Thank you dbh ! 
&lt;BR /&gt;To answer you, several things : 
&lt;BR /&gt; 
&lt;BR /&gt;I've already written the python script 
&lt;BR /&gt;I'm a beginner in Talend (but I have to work with jobs already built) 
&lt;BR /&gt;The script is looking in different ways in the data already processed (comparison, eliminate duplications, insertions...) 
&lt;BR /&gt;It would be easier to upgrade the script (adding more error types/messages for instance) than modify Talend 
&lt;BR /&gt;But, if I hadn't spent hours on the script before, I certainly would have use Talend components. 
&lt;BR /&gt;Thanks again !</description>
      <pubDate>Wed, 02 Mar 2016 09:27:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/resolved-Execute-python-script-using-tSystem/m-p/2219425#M14238</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-02T09:27:37Z</dc:date>
    </item>
  </channel>
</rss>

