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?
execute command to launch a python csv to xml script
execute command to launch a python csv to xml script
Can you try changing the arguments to: -c 'python Volumes/HD/Desktop/csv2xml.py "%1" > "%2"'
If this doesn't work, I would suggest wrapping the whole thing into a bash script, and using that in the command property.
If this doesn't work, I would suggest wrapping the whole thing into a bash script, and using that in the command property.
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
execute command to launch a python csv to xml script
Hello, I've written a 100% Switch Javascript CSV->XML conversion if you are interested.
Dwight Kelly
Apago, Inc.
dkelly@apago.com
Dwight Kelly
Apago, Inc.
dkelly@apago.com
execute command to launch a python csv to xml script
Hello, I've written a 100% Switch Javascript CSV->XML conversion if you are interested.
This would be an even better solution. It would be great if you can share it with me!
Can you try changing the arguments to: -c 'python Volumes/HD/Desktop/csv2xml.py "%1" > "%2"'
I tried that, but sadly it didn't change anything.
This would be an even better solution. It would be great if you can share it with me!
Can you try changing the arguments to: -c 'python Volumes/HD/Desktop/csv2xml.py "%1" > "%2"'
I tried that, but sadly it didn't change anything.
-
- Newbie
- Posts: 1
- Joined: Tue Aug 02, 2011 9:49 am
execute command to launch a python csv to xml script
hello,
excuse me for my poor english because i'm french.
I have a full flow in python.
that's work very well
Try to use the absolut path for python
excuse me for my poor english because i'm french.
I have a full flow in python.
that's work very well
Try to use the absolut path for python