funziona senza os.chdir
This commit is contained in:
@@ -30,7 +30,7 @@ class bananaSPLITTER(QThread):
|
||||
self.docStruct = self.fileParams['docStruct']
|
||||
self.settings = self.fileParams['settings']
|
||||
self.fileName = self.fileParams['name']
|
||||
self.outPath = self.paths['OUTworkPath']+slugify(self.fileName)
|
||||
self.outPath = self.paths['OUTworkPath']+slugify(self.fileName)+'/'
|
||||
self.beginTime = time.time()
|
||||
pass
|
||||
else:
|
||||
@@ -59,7 +59,7 @@ class bananaSPLITTER(QThread):
|
||||
if self.settings['removeOldFiles']:
|
||||
#os.chdir(self.outPath)
|
||||
for f in os.listdir(self.outPath):
|
||||
os.remove(f)
|
||||
os.remove(self.outPath+f)
|
||||
else:
|
||||
raise FileExistsError("Non posso sovrascrivere i vecchi file, eliminali manualmente!")
|
||||
else:
|
||||
@@ -244,7 +244,7 @@ class bananaSPLITTER(QThread):
|
||||
outFileCounter = 0
|
||||
self.paths['OUTworkPath']=self.paths['OUTworkPath']+slugify(self.fileName)
|
||||
self.log.info("Salvo gli articoli in file separati...")
|
||||
self.log.debug("Persorso: {0}".format(self.paths['OUTworkPath'].format('nomeFile')))
|
||||
self.log.debug("Persorso: {0}".format(self.outPath))
|
||||
for ff in self.contentList:
|
||||
try:
|
||||
if ff['duplicate'] == False:
|
||||
@@ -274,12 +274,12 @@ class bananaSPLITTER(QThread):
|
||||
def saveBody(self):
|
||||
self.log.info('Salvo gli articoli in un singolo file vicino agli originali...')
|
||||
self.log.debug('Persorso: {0}'.format(self.outPath))
|
||||
os.chdir(self.outPath)
|
||||
#os.chdir(self.outPath)
|
||||
try:
|
||||
fName=self.outPath+slugify(self.fileName)
|
||||
fName=slugify(self.fileName)
|
||||
fName='BODYFILE_{0}.txt'.format(fName[:self.docStruct['maxTitleLen']])
|
||||
fileContent = os.linesep.join([cc['content'] for cc in self.contentList])
|
||||
out=open('{0}'.format(fName),'wb')
|
||||
out=open(self.outPath+'{0}'.format(fName),'wb')
|
||||
out.write(fileContent.encode(self.settings['encoding']))
|
||||
out.close()
|
||||
except IOError as e:
|
||||
|
||||
Reference in New Issue
Block a user