Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kliment/Printrun.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvolconst <20997907+volconst@users.noreply.github.com>2021-02-05 16:12:19 +0300
committervolconst <20997907+volconst@users.noreply.github.com>2021-02-05 16:12:19 +0300
commitd1c09af6fdbc56296c67b80993e5c327d8213286 (patch)
tree407bbe9aa5747033f05606207232c6dfafa5b925
parent5d0ec6d25dd67fc51afccf028d4e77606ec81900 (diff)
Fix printcore.runSmallScript
The code tries to remove comments, but also removes the last character if no comments
-rw-r--r--printrun/printcore.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/printrun/printcore.py b/printrun/printcore.py
index ea209a7..eaa774d 100644
--- a/printrun/printcore.py
+++ b/printrun/printcore.py
@@ -514,13 +514,12 @@ class printcore():
# run a simple script if it exists, no multithreading
def runSmallScript(self, filename):
- if filename is None: return
- f = None
+ if not filename: return
try:
with open(filename) as f:
for i in f:
l = i.replace("\n", "")
- l = l[:l.find(";")] # remove comments
+ l = l.partition(';')[0] # remove comments
self.send_now(l)
except:
pass