rtlamr | An rtl-sdr receiver for Itron ERT compatible smart meters operating in the 900MHz ISM band | Navigation library
kandi X-RAY | rtlamr Summary
kandi X-RAY | rtlamr Summary
An rtl-sdr receiver for Itron ERT compatible smart meters operating in the 900MHz ISM band.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of rtlamr
rtlamr Key Features
rtlamr Examples and Code Snippets
Community Discussions
Trending Discussions on rtlamr
QUESTION
How do I truncate a csv log file that is being used as std out pipe destination from another process without generating a _csv.Error: line contains NULL byte
error?
I have one process running rtlamr > log/readings.txt
that is piping radio signal data to readings.txt
. I don't think it matters what is piping to the file--any long-running pipe process will do.
I have a file watcher using watchdog
(Python file watcher) on that file, which triggers a function when the file is changed. The function read the files and updates a database.
Then I try to truncate readings.txt
so that it doesn't grow infinitely (or back it up).
ANSWER
Answered 2020-Feb-02 at 00:31If you truncate
a file1 while another process has it open in w
mode, that process will continue to write to the same offsets, making the file sparse. Low offsets will thus be read as 0
s.
As per x11 - Concurrent writing to a log file from many processes - Unix & Linux Stack Exchange and Can two Unix processes simultaneous write to different positions in a single file?, each process that has a file open has its own offset in it, and a ftruncate()
doesn't change that.
If you want the other process to react to truncation, it needs to have it open in a
mode.
Your approach has principal bugs, too. E.g. it's not atomic: you may (=will, eventually) truncate the file after the producer has added data but before you have read it so it would get lost.
Consider using dedicated data buffering utilities instead like buffer
or pv
as per Add a big buffer to a pipe between two commands.
1Which is superfluous because open(mode='w')
already does that. Either truncate
or reopen, no need to do both.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install rtlamr
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page