[Tutor] Working with output of a subprocess

2013-01-11 Thread 3n2 Solutions
Hello,

Need some help with working with a text file.
Is it possible to get the values associated with each of the parameter in
the below text file format? For example:

1. How can I check what the Min and Max values are?
2. How to check the second column value associated with "epoch2"?

Your help is greatly appreciated. I'm using Python 2.7 on Windows7.



Examining file: 5521W231.txt

Duration :  0h : 59m
First meas : week   :  86 :   1721
Last  meas : week   :  89 :   1721

Min val   : 15
Max val : 18
3D :   3600  100.0%

summary Total  MissedRate
epoch1:1378   0   0\1000
epoch2:2154   1   0\1000


Thanks,
Tim
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] how to track an entry in a large text file

2013-01-16 Thread 3n2 Solutions
Say I have a text file (example below) that has multiple records with
the same format but not always the same number of lines.  Each record
is separated by the line that starts with “Examining file” as in below
example. If you notice, the 3D Val is not there for the second record.
How do I report that the “3D Val” is not present for that particular
record “8866W2310089.txt”?
Thanks to Alan for his reply.



Examining file: 5521W231.txt

Duration :  0h : 59m
First meas : week   :  86 :   1721
Last  meas : week   :  89 :   1721

Min val   : 15
Max val : 18
3D :   3600  100.0%

summary Total  MissedRate
epoch1:1378   0   0\1000
epoch2:2154   1   0\1000



Examining file: 8866W2310089.txt

Duration :  0h : 59m
First meas : week   :  87 :   1721
Last  meas : week   :  84 :   1721

Min val   : 16
Max val : 19

summary Total  MissedRate
epoch1:1378   0   0\1000
epoch
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Can Python monitor web browser content

2013-01-25 Thread 3n2 Solutions
Hello,

I was wondering if Python can monitor web browser content.
Specifically, I'm connected to a Machine to Machine device
(essentially a Gateway) and monitoring its activity on a web browser
(either IE or Chrome). There are certain parameters like RSSI
(received signal strength indicator ) that I would like to monitor
(read and record) for a one minute period. Is this possible in Python?
If not, what can achieve this?

I'm using Python 2.7 on Windows 7

Thank you!
Tim
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] help with running perl script that writes to a text file

2013-02-05 Thread 3n2 Solutions
Hello,

I want to automate the following manual process from DOS promp:

c:/scripts/perl>perl fix.pl base.gtx >base.txt

Here is my python script:

path="c:/scripts/perl/"
subprocess.call(['perl','fix.pl','base.gtx >base.txt',path])

I also tried this alternative:

subprocess.Popen(['perl','fix.pl','base.gtx >base.txt',path]) #same
result from this method.

The above script generates the base.txt file but has no content in it.

any ideas as to why the resulting text file is empty? Am I using the
correct python commands to run the above manual process?

I'm using python 2.7 on windows 7

Thanks,
Tim
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Digest, Vol 108, Issue 22

2013-02-06 Thread 3n2 Solutions
On Wed, Feb 6, 2013 at 3:00 AM,   wrote:
> Send Tutor mailing list submissions to
> tutor@python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://mail.python.org/mailman/listinfo/tutor
> or, via email, send a message with subject or body 'help' to
> tutor-requ...@python.org
>
> You can reach the person managing the list at
> tutor-ow...@python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Tutor digest..."
>
>
> Today's Topics:
>
>1. Re: help with running perl script that writes to a text file
>   (Peter Otten)
>2. Re: help with running perl script that writes to a text file
>   (eryksun)
>
>
> --
>
> Message: 1
> Date: Wed, 06 Feb 2013 11:12:54 +0100
> From: Peter Otten <__pete...@web.de>
> To: tutor@python.org
> Subject: Re: [Tutor] help with running perl script that writes to a
> text file
> Message-ID: 
> Content-Type: text/plain; charset="ISO-8859-1"
>
> 3n2 Solutions wrote:
>
>> Hello,
>>
>> I want to automate the following manual process from DOS promp:
>>
>> c:/scripts/perl>perl fix.pl base.gtx >base.txt
>>
>> Here is my python script:
>>
>> path="c:/scripts/perl/"
>> subprocess.call(['perl','fix.pl','base.gtx >base.txt',path])
>>
>> I also tried this alternative:
>>
>> subprocess.Popen(['perl','fix.pl','base.gtx >base.txt',path]) #same
>> result from this method.
>>
>> The above script generates the base.txt file but has no content in it.
>>
>> any ideas as to why the resulting text file is empty? Am I using the
>> correct python commands to run the above manual process?
>
> I'm surprised that base.txt is generated at all, I'd expect fix.pl to look
> for a file named "base.gtx >base.txt" and complain when it doesn't find
> that.
>
> I think the following should work:
>
> with open("c:/scripts/perl/base.txt", "w") as f:
> subprocess.check_call(
> ["perl",
>  "c:/scripts/perl/fix.pl",
>  "c:/scripts/perl/base.gtx"],
> stdout=f)
>
>

Peter, that did it! Thank you.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Running EXE file with arguments

2013-03-08 Thread 3n2 Solutions
Below is the shell command that works fine if ran as is:
C:\FinalTest>fix.exe -com 17 -baud 38400 -setconfig base.dat

I'm trying to automate it using the following python command but it
gives me an error: "returned non-zero exit status 1"

subprocess.check_call(['c:/FinalTest/fix.exe', '-com 17','-baud
38400', '-setconfig base.dat'])

Where is the problem?

Thank You!
Tim
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor