summaryrefslogtreecommitdiff
path: root/src/bcdd
diff options
context:
space:
mode:
authorMichał Klichowicz <emkael@tlen.pl>2023-09-30 13:14:45 +0200
committerMichał Klichowicz <emkael@tlen.pl>2023-09-30 13:14:45 +0200
commitcfe576d81fa2b6be345bb60d4724d60f8880b5b4 (patch)
tree2dc829c048a3dca2c4e4f5d2b28d5e63ff0031c4 /src/bcdd
parent14a168065571448c19047cdedf262642cf9f8371 (diff)
* passed-out hands
* proper logging * fetching remote PBN file
Diffstat (limited to 'src/bcdd')
-rw-r--r--src/bcdd/PBNFile.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/bcdd/PBNFile.py b/src/bcdd/PBNFile.py
index f5436ad..90f9562 100644
--- a/src/bcdd/PBNFile.py
+++ b/src/bcdd/PBNFile.py
@@ -5,13 +5,12 @@ from .PBNBoard import PBNBoard
class PBNFile(object):
- def __init__(self, filename):
+ def __init__(self, pbn_file, filename=None):
self._filename = filename
self.output_file = None
self.boards = []
lines = []
- with open(self._filename) as pbn_file:
- contents = pbn_file.readlines()
+ contents = pbn_file.readlines()
first_line = 1
for line_no in range(0, len(contents)):
line = contents[line_no].strip()
@@ -40,4 +39,5 @@ class PBNFile(object):
raise IOError('No boards written to PBN file, unable to save it.')
tmp_path = self.output_file.name
self.output_file.close()
- shutil.move(tmp_path, self._filename)
+ if self._filename is not None:
+ shutil.move(tmp_path, self._filename)