Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tommy Olofsson
LabComm
Commits
27dc184c
Commit
27dc184c
authored
Feb 02, 2015
by
Tommy Olofsson
Browse files
Do not let the readers reopen the file.
parent
2f9091de
Changes
1
Hide whitespace changes
Inline
Side-by-side
tools/lc2csv.py
View file @
27dc184c
...
@@ -6,8 +6,8 @@ import labcomm
...
@@ -6,8 +6,8 @@ import labcomm
class
Reader
(
object
):
class
Reader
(
object
):
def
__init__
(
self
,
_
file
):
def
__init__
(
self
,
file
_
):
self
.
_file
=
open
(
_
file
)
self
.
_file
=
file
_
def
read
(
self
,
count
):
def
read
(
self
,
count
):
data
=
self
.
_file
.
read
(
count
)
data
=
self
.
_file
.
read
(
count
)
...
@@ -106,11 +106,11 @@ def main():
...
@@ -106,11 +106,11 @@ def main():
"Requires -f."
)
"Requires -f."
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
d
=
labcomm
.
Decoder
(
Reader
(
args
.
elc
))
seen
=
{}
seen
=
{}
current
=
{}
current
=
{}
_type
=
{}
_type
=
{}
file_
=
open
(
args
.
elc
)
d
=
labcomm
.
Decoder
(
Reader
(
file_
))
# Do one pass through the file to find all registrations.
# Do one pass through the file to find all registrations.
while
True
:
while
True
:
try
:
try
:
...
@@ -126,10 +126,11 @@ def main():
...
@@ -126,10 +126,11 @@ def main():
# Do another pass to extract the data.
# Do another pass to extract the data.
current
=
{}
current
=
{}
file_
.
seek
(
0
)
if
args
.
follow
:
if
args
.
follow
:
reader
=
FollowingReader
(
args
.
elc
,
args
.
interval
,
args
.
timeout
)
reader
=
FollowingReader
(
file_
,
args
.
interval
,
args
.
timeout
)
else
:
else
:
reader
=
Reader
(
args
.
elc
)
reader
=
Reader
(
file_
)
d
=
labcomm
.
Decoder
(
reader
)
d
=
labcomm
.
Decoder
(
reader
)
while
True
:
while
True
:
try
:
try
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment