I'm developing a multiplatform application in pyQT4 and numpy and actually it doesn't work on my linux system (Xubuntu 12.04) even so it seems work great on windows 7. So, the problem comes from my import files method (It is in a PyQT4 class) :
def import_folder(self,abs_path,folder_list):
for folder_i in folder_list:
filenames = glob.glob("%s/%s/*.txt" %( abs_path,folder_i ))
aa =list(filenames)[1]
print filenames
data_fichier = np.genfromtxt("%s" %(aa),delimiter=';',skip_header=35,usecols=[8])
data_fichier2 = np.zeros((data_fichier.shape[0],))
And this is the error I get :
data_fichier = np.genfromtxt("%s" %aa,delimiter=';',skip_header=35,usecols=[8])
File "/usr/lib/python2.7/dist-packages/numpy/lib/npyio.py", line 1241, in genfromtxt
fhd = iter(np.lib._datasource.open(fname, 'rbU'))
File "/usr/lib/python2.7/dist-packages/numpy/lib/_datasource.py", line 145, in open
return ds.open(path, mode)
File "/usr/lib/python2.7/dist-packages/numpy/lib/_datasource.py", line 472, in open
found = self._findfile(path)
File "/usr/lib/python2.7/dist-packages/numpy/lib/_datasource.py", line 315, in _findfile
filelist += self._possible_names(self.abspath(path))
File "/usr/lib/python2.7/dist-packages/numpy/lib/_datasource.py", line 364, in abspath
splitpath = path.split(self._destpath, 2)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 14: ordinal not in range(128)
I have printed my "filenames" variables :
[u'/home/*****/Documents/Plate_test/Track-Arousal_experiment_24_06_13_track_1-Trial 2-7-Subject 1.txt', u'/home/*****/Documents/Plate_test/Track-Arousal_experiment_24_06_13_track_1-Trial 2-5-Subject 1.txt']
Therefore, the problem comes from the unicode mode (the "u" at the begining of the list elements). And I don't know at all why I get this unicode mode with my linux system. Have you any ideas how I can remove it and turn of in the "regular" mode (sorry for the terminology, I'm not an expert) ? (Or others ideas about my problem).
(Just for you know, when I have launched the method as a simple function without the PyQT class, it works great, so I suspect it.)
Thanks,
Lem