Im trying to run subprocess. Im running a python file on a directory (to convert each file in the directory.) The convertor works and ive been implementing this into a gui(PYQT4). Here is what I got so far:
def selectFile(self):
    self.listWidget.clear() # In case there are any existing elements in the list
    directory = QtGui.QFileDialog.getExistingDirectory(self,
                                                       "Pick a folder")
    if directory:
        for file_name in os.listdir(directory):
            if file_name.endswith(".csv"):
                self.listWidget.addItem(file_name)
                print (file_name)
def convertfile(self, directory):
    subprocess.call(['python', 'Createxmlfromcsv.py', directory], shell=True)
The error im getting is ..
Traceback (most recent call last):
  File "/Users/eeamesX/PycharmProjects/Workmain/windows.py", line 162, in convertfile
    subprocess.call(['python', 'Createxmlfromcsv.py', directory], shell=True)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 522, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
TypeError: execv() arg 2 must contain only strings
Any help for a beginner is appreciated :)
 
     
     
    