forse tolti tutti i os.chdir
This commit is contained in:
@@ -1 +0,0 @@
|
||||
Qui si mettono i file di test per la versione GUI di bananaSPLIT
|
||||
@@ -3,7 +3,7 @@
|
||||
"paths": {
|
||||
"lastUsed": "defaults.json",
|
||||
"configurationPath": "D:/Emanuele/Documenti/workspace/bananaSPLIT/bananaSPLIT/conf/",
|
||||
"INworkPath": "D:/Emanuele/Documenti/workspace/bananaSPLIT/TestFiles",
|
||||
"INworkPath": "D:/Emanuele/Documenti/workspace/bananaSPLIT/TestFiles/",
|
||||
"OUTworkPath": "H:/",
|
||||
"fileList": [
|
||||
"GUARDIAN 1993.txt",
|
||||
|
||||
@@ -57,14 +57,14 @@ class bananaSPLITTER(QThread):
|
||||
# preparo e inizio il salvataggio
|
||||
if os.path.exists(self.outPath):
|
||||
if self.settings['removeOldFiles']:
|
||||
os.chdir(self.outPath)
|
||||
#os.chdir(self.outPath)
|
||||
for f in os.listdir(self.outPath):
|
||||
os.remove(f)
|
||||
else:
|
||||
raise FileExistsError("Non posso sovrascrivere i vecchi file, eliminali manualmente!")
|
||||
else:
|
||||
os.mkdir(self.outPath)
|
||||
os.chdir(self.outPath)
|
||||
#os.chdir(self.outPath)
|
||||
if self.settings['saveSeparateFiles']:
|
||||
self.saveSeparate()
|
||||
if self.settings['saveBodyFile']:
|
||||
@@ -83,9 +83,9 @@ class bananaSPLITTER(QThread):
|
||||
|
||||
def openFile(self):
|
||||
try:
|
||||
os.chdir(self.paths["INworkPath"])
|
||||
#os.chdir(self.paths["INworkPath"])
|
||||
self.log.info("Carico il contenuto..")
|
||||
fp = open(self.fileParams['name'], mode='r', encoding=self.settings['encoding'])
|
||||
fp = open(self.paths["INworkPath"]+'/'+self.fileParams['name'], mode='r', encoding=self.settings['encoding'])
|
||||
self.rawFile = fp.readlines()
|
||||
fp.close()
|
||||
except IOError as e:
|
||||
@@ -253,7 +253,7 @@ class bananaSPLITTER(QThread):
|
||||
docnum=outFileCounter,\
|
||||
papername=ff['newsPaperName'].strip(),\
|
||||
**ff['date'])
|
||||
out=open('{0}'.format(fName),'wb')
|
||||
out=open(self.outPath+'{0}'.format(fName),'wb')
|
||||
if self.settings['includeTitle']:
|
||||
ff['content'] = ff['title']+os.linesep+ff['content']
|
||||
out.write(ff['content'].encode(self.settings['encoding']))
|
||||
@@ -276,7 +276,7 @@ class bananaSPLITTER(QThread):
|
||||
self.log.debug('Persorso: {0}'.format(self.outPath))
|
||||
os.chdir(self.outPath)
|
||||
try:
|
||||
fName=slugify(self.fileName)
|
||||
fName=self.outPath+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')
|
||||
|
||||
Reference in New Issue
Block a user