RE: Linux shell to python

2012-07-30 Thread Paul van der Linden
You can do this with one subprocess.Popen and some python commands.

The alternative is to pipe some subprocess.Popen commands together.

Or for the quick way out (but I think you better stick with bash scripting 
then): http://pypi.python.org/pypi/sarge/

Don't know about it's stability/ubs/etc, never used it.
 
-Original message-
From:Vikas Kumar Choudhary vikas.choudh...@yahoo.co.in
Sent:Mon 30-07-2012 09:34
Subject:Linux shell to python
To:python-list@python.org; 
 
Dear friends,

I just joined the group.
I was trying porting from bash shell to python.

 let me know if someone has tried to implement (grep and PIPE)  shell commands 
in python `lspci | grep Q | grep  $isp_str1 | grep $isp_str2 | cut -c1-7'
 I tried to use python subprocess and OS.Popen modules.

Thanks  Regard's

Vikas Kumar Choudhary 


(Yahoo,MSN-Hotmail,Skype) Messenger = vikas.choudhary
Please Add Me in Your Messenger List for Better Communication
 
P  Please consider the environment before printing this e-mail
Do not print this email unless it is absolutely necessary. 
Save papers, Save tree.

Note: This e-mail is confidential and may also be privileged, this is for the 
intended recipients only. If you are not the intended recipient, please delete 
the message and notify me immediately; you should not copy or use it for any 
purpose, nor disclose its contents to any other person.

Notice:  All email and instant messages (including attachments) sent to or from 
This E-mail id , may be retained, monitored and/or reviewed, or authorized law 
enforcement personnel, without further notice or consent.
--
 

-- 
 http://mail.python.org/mailman/listinfo/python-list
 

 -- 
http://mail.python.org/mailman/listinfo/python-list


RE: simplified Python parsing question

2012-07-30 Thread Paul van der Linden
Another possibility is to use the ast module of python: 
http://docs.python.org/library/ast.html

The only problem with that module, is that everything you parse must be 
correct, otherwise it throws an exception, I don't know if that's a problem for 
your project?
 
-Original message-
From:Eric S. Johansson e...@harvee.org
Sent:Mon 30-07-2012 12:00
Subject:Re: simplified Python parsing question
To:python-list@python.org; 
On 7/30/2012 5:25 AM, Laszlo Nagy wrote:

 Did you try to use pygments?

 http://pygments.org/docs/api/


thanks, I'll take a look.


 I would first tokenize the code, then divide it by statement keywords. 
 Finally, you just need to find expression/assignment statements in the 
 remaining sections. (Maybe there is a better way to do it.)




yeah the problem is also little more complicated than simple parsing of Python 
code. For example, one example (from the white paper)

*meat space blowback = Friends and family [well-meaning attempt]

*could that be parsed by the tools you mention? I suspect not but this is what 
I 
need to generate using speech recognition because it's easily spoken. A more 
complex example might be something like

new base = OS path-base name (old path)

or

if OS base exists (current path): new base name = OS path base name(current 
path)

What's particularly cute here is that using the translation technique I can 
actually describe the full object method path with a minimum of speaking 
overhead. Python is great. :-)

But the questions remain, will these tools are stuff like this?


-- 
http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Is Python a commercial proposition ?

2012-07-29 Thread Paul van der Linden
Scripting is one of the strong sides of python. I use it al the time to quickly 
write a script to analyze something or automate. That is probably the reason it 
is used to glue (script) things together and is embedded in some programs (like 
Maya and such).

At the company we're using python and django for websites, from small micro 
sites till big enterprise sites.

Currently I'm working on a highly configurable application to control a maya 
render cluster.

You can also use it for testing and even frontend testing.

I think you can use python for almost everything, tough I think it's less 
suitable for non-web gui applications.

lipska the kat lip...@yahoo.co.ukschreef:

Pythoners

Firstly, thanks to those on the tutor list who answered my questions.

I'm trying to understand where Python fits into the set of commonly 
available, commercially used languages of the moment.

My most recent experience is with Java. The last project I was involved 
with included 6775 java source files containing 1,145,785 lines of code. 
How do I know this? because I managed to cobble together a python script 
that walks the source tree and counts the lines of code. It ignores 
block and line comments and whitespace lines so I'm fairly confident 
it's an accurate total. It doesn't include web interface files (mainly 
.jsp and HTML) or configuration files (XML, properties files and what 
have you). In fact it was remarkably easy to do this in python which got 
me thinking about how I could use the language in a commercial environment.

I was first attracted to python by it's apparent 'Object Orientedness' I 
soon realised however that by looking at it in terms of the language I 
know best I wasn't comparing like with like. Once I had 'rebooted the 
bioware' I tried to approach python with an open mind and I have to say 
it's growing on me.

The questions I have are ...

How is python used in the real world.
What sized projects are people involved with
Are applications generally written entirely in python or is it more 
often used for a subset of functionality.

I hope this is an acceptable question for this group

Many thanks

Lipska

-- 
Lipska the Kat: Troll hunter, sandbox destroyer
and farscape dreamer of Aeryn Sun
-- 
http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


[issue6833] incorrect: failed local variable referenced before assignment

2009-09-03 Thread Paul van der Linden

New submission from Paul van der Linden p...@soulbase.nl:

The attached python file will give the following output, which is 
incorrect behavior as far as I know:

this will fail
failed local variable 'in_std' referenced before assignment

this won't fail
Not failed
this won't fail either
Not failed


This is tested on windows with python2.6(standard msi) and on centos 
5.3 with python2.6 (custom rpm), python2.4 (system rpm), freebsd with 
python2.5 (system package), python2.6 (hand compiled) and python3.0 
(hand compiled).

The attached code is stripped down to the bare minimum and therefore 
won't do anything usefull.

--
components: None
files: bug.py
messages: 92199
nosy: paultjuhatwork
severity: normal
status: open
title: incorrect: failed local variable referenced before assignment
type: behavior
versions: Python 2.4, Python 2.5, Python 2.6, Python 3.0
Added file: http://bugs.python.org/file14825/bug.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6833
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com