Skip to content

Commit 4ff2ca4

Browse files
authored
Merge pull request #144 from openxc/print-flush
Flush After Print Statements
2 parents c960b76 + 437be38 commit 4ff2ca4

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

openxc/tools/dump.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
from openxc.formats.json import JsonFormatter
1414
from .common import device_options, configure_logging, select_device
1515

16+
import functools
17+
print = functools.partial(print, flush=True)
18+
1619
def receive(message, **kwargs):
1720
message['timestamp'] = time.time()
1821
print((JsonFormatter.serialize(message)))

openxc/tools/obd2scanner.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
from .common import device_options, configure_logging, select_device
1313
import json
1414

15+
import functools
16+
print = functools.partial(print, flush=True)
17+
1518
def scan(controller, bus=None):
1619

1720
# TODO could read the response from the "PIDs supported" requests to see
@@ -28,7 +31,6 @@ def scan(controller, bus=None):
2831

2932
if (no_response == True):
3033
print("PID 0x%x did not respond" % pid)
31-
sys.stdout.flush()
3234

3335
def parse_options():
3436
parser = argparse.ArgumentParser(description="Send requests for all "

openxc/tools/scanner.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
from .common import device_options, configure_logging, select_device
1414

15+
import functools
16+
print = functools.partial(print, flush=True)
17+
1518
TESTER_PRESENT_MODE = 0x3e
1619
TESTER_PRESENT_PAYLOAD = bytearray([0])
1720

0 commit comments

Comments
 (0)