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