execute command to launch a python csv to xml script
Posted: Sun Jul 03, 2011 5:47 pm
Hi,
I am running PowerSwitch 10 on Mac OS 10.6.
I try to run a python script with the "execute command" tool to convert csv files to xml.
the python script looks like that:
#! /usr/bin/env python
import sys
import csv
csv.register_dialect('custom',
delimiter=',',
doublequote=True,
escapechar=None,
quotechar='"',
quoting=csv.QUOTE_MINIMAL,
skipinitialspace=False)
with open(sys.argv[1]) as ifile:
data = csv.reader(ifile, dialect='custom')
print ""
for record in data:
print " "
for i, field in enumerate(record):
print " " % i + field + "" % i
print " "
print ""
The script itself works fine if run "manually" in the terminal application.
I now want switch to run the script..
I configured the "execute command" flow element with these properties:
command or path: /bin/bash
arguments: python Volumes/HD/Desktop/csv2xml.py "%1" > "%2"
Output: file at path
Output extension: XML (*.xml)
But i never got any file written into my output folder. The message given by the "execute command" is that: "File '_00023_input.csv' was sent to null; it will be deleted when the entry point finishes"
Can somebody please tell me what i am doing wrong here?
I am running PowerSwitch 10 on Mac OS 10.6.
I try to run a python script with the "execute command" tool to convert csv files to xml.
the python script looks like that:
#! /usr/bin/env python
import sys
import csv
csv.register_dialect('custom',
delimiter=',',
doublequote=True,
escapechar=None,
quotechar='"',
quoting=csv.QUOTE_MINIMAL,
skipinitialspace=False)
with open(sys.argv[1]) as ifile:
data = csv.reader(ifile, dialect='custom')
print ""
for record in data:
print " "
for i, field in enumerate(record):
print " " % i + field + "" % i
print " "
print ""
The script itself works fine if run "manually" in the terminal application.
I now want switch to run the script..
I configured the "execute command" flow element with these properties:
command or path: /bin/bash
arguments: python Volumes/HD/Desktop/csv2xml.py "%1" > "%2"
Output: file at path
Output extension: XML (*.xml)
But i never got any file written into my output folder. The message given by the "execute command" is that: "File '_00023_input.csv' was sent to null; it will be deleted when the entry point finishes"
Can somebody please tell me what i am doing wrong here?