summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2015-10-23 23:11:40 +0200
committeremkael <emkael@tlen.pl>2015-10-23 23:11:40 +0200
commit0c8b2de2daa887c014004218f443296cd1bcb548 (patch)
tree74a2c5cfaf1f57cd7c5e7c90db12ab1900a08b4f
parent9628dd97beb8d45df8ce897bc64af789be63c254 (diff)
* path parsing fixesHEADmaster
-rw-r--r--rrb2txt.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/rrb2txt.py b/rrb2txt.py
index e14ec9c..8586f11 100644
--- a/rrb2txt.py
+++ b/rrb2txt.py
@@ -4,6 +4,7 @@ import sys
import os
import re
import urlparse
+import lxml
from bs4 import BeautifulSoup, Comment
from glob import glob
@@ -425,13 +426,18 @@ class RRBTxtGen(object):
self.__directory = directory
def generate(self):
- file_prefix = os.path.dirname(self.__directory).split('/')[-1]
+ file_prefix = os.path.abspath(
+ self.__directory).strip(os.sep).split(os.sep)[-1]
header = self.get_header() + ['']
output = self.compile_dir()
for filepath, rows in output.iteritems():
- output_file = open(file_prefix + filepath + '.txt', 'w')
+ output_file = open(os.path.join(
+ os.path.abspath(self.__directory),
+ file_prefix) + filepath + '.txt', 'w')
+ print os.path.abspath(self.__directory), file_prefix
+ print os.path.join(os.path.abspath(self.__directory), file_prefix)
for line in header:
output_file.write(line.encode('windows-1250') + '\n')
for row in rows: