[Tutor] bind line-oriented device output?

Fiyawerx fiyawerx at gmail.com
Tue Mar 30 04:43:55 CEST 2010


On Mon, Mar 29, 2010 at 11:56 AM, Tom Roche <Tom_Roche at pobox.com> wrote:

>
> http://mail.python.org/pipermail/tutor/2010-March/075438.html
> >> I'd like to learn to pythonically redirect the output from a
> >> line-oriented character device to a particular file or process,
> >> regardless of focus, on a generic graphical OS. But I don't want to
> >> redirect stdin entirely.
> ...
> >> It Would Be Nice, and useful for this seminar's mechanics, to be
> >> able to run some code to which one could say, see this device? and
> >> this file? Make the device's output go only to that file. For extra
> >> credit, don't let anything else write that file while this code is
> >> running.
>


> 1 does not redirect all of stdin, only the output from the scanner.
>  The user is allowed to continue to work on other tasks (e.g. with
>  output from the laptop's keyboard going to whatever frame), with
>  only the output from the scanner being bound to a particular file or
>  process.
>
>
This may be out of my league, but what about pyUSB? (
http://pyusb.sourceforge.net/docs/1.0/tutorial.html)

Possibly a program that just runs in the background, waits for input from
the usb scanner, and appends the id to a specified file when it catches it?
That way you also don't need to keep the file open the whole time, in case
someone accidentally forgets to plug it in or shuts down while the program
is still writing? I'm sure there are a lot of better ways to handle the
actual file writing, but thought it might help.

Just a noobs $.02
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100329/e9576704/attachment.html>


More information about the Tutor mailing list