title: syntax error near unexpected token '(' in python script
body: <p>I'm trying to run a python script to input values from data in an excel sheet into a web application. I'm currently stuck as I get the following message when I try to run the script &quot;sh: -c: line 11: syntax error near unexpected token `('&quot;</p>
  <p>Below is my script</p>
  <pre><code>import os
  import time
  import pandas as pd
  
  source_path = 'excel_file_path'
  API_KEY = 'api_key'
  source_file = pd.ExcelFile(source_path)
  dfs = {sheet_name: source_file.parse(sheet_name) for sheet_name in source_file.sheet_names}
  for index, row in dfs.items():
      cmd = &quot;cmd /k 'curl -X PATCH https://translation.io/api/v1/segments/{SEGMENT_ID}.json -H \&quot;content-type: application/json\&quot; -d\&quot;{{ \'api_key\': \'{API_KEY}\', \'target\': \'{TARGET}\' }}\'&quot;.format(SEGMENT_ID=row['id'], API_KEY=API_KEY, TARGET=row['target'])
      print(cmd)
      os.system(cmd)
      time.sleep(1)
  </code></pre>
  <p>It looks like there is an issue with the Print function. I want it to take the value of whatever 'cmd' is equal to above for the &quot;SEGMENT_ID&quot; and &quot;TARGET&quot; variables.</p>
  <p>Let me know if you can assist or need more information. I use python on a Mac.</p>
  <p>See below full trace when trying to run the script from Mac Terminal</p>
  <pre><code>Last login: Tue Jul 21 14:02:59 on ttys000
  (base) MacBook-Pro-2:~ lespesmunozthomas$ python /Users/lespesmunozthomas/Desktop/2M/Operations/Tanda/excelcmdprompttestfr.py
  cmd /k 'curl -X PATCH https://translation.io/api/v1/segments/0      8534085
  1      8534086
  2      8534087
  3      8534088
  4      8534089
          ...   
  312    8534397
  313    8534398
  314    8534399
  315    8534400
  316    8534401
  Name: id, Length: 317, dtype: int64.json -H &quot;content-type: application/json&quot; -d&quot;{ 'api_key': '5aba962e7e1c4be68b01e3bcd3edb643', 'target': '0      Laisser un blanc pour la valeur par défaut (&quot;%...
  1                                                  Lundi
  2                                                  Mardi
  3                                               Mercredi
  4                                                  Jeudi
                               ...                        
  312                                        Pas d'en-tête
  313    N'affichez pas d'en-tête (pas de description d...
  314                                                    ,
  315                               Séparateur de colonnes
  316                                             Dimanche
  Name: target, Length: 317, dtype: object' }'
  sh: -c: line 11: syntax error near unexpected token `('
  sh: -c: line 11: `Name: id, Length: 317, dtype: int64.json -H &quot;content-type: application/json&quot; -d&quot;{ 'api_key': '5aba962e7e1c4be68b01e3bcd3edb643', 'target': '0      Laisser un blanc pour la valeur par défaut (&quot;%...'
  </code></pre>
  <p>Cheers
  Thomas</p>