Reg python regexp

2018-03-21 Thread sankarramanv
Hi,

I have a requirement.

cmd="cat |grep -c 'if [ -t 1 ]; then mesg n 2>/dev/null; fi'"

I need to escape only the square brackets in above variable since its not 
grepping without escaping the brackets.

Please help.

Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-list


Custom Python import module failed (protobuf)

2018-04-20 Thread sankarramanv
Hi,

I need to use the google protobuf for my task.

1. Yum install protobuf worked for default python 2.7.5 in my VM. But I need to 
test with Python 2.7.14.



I installed protobuf using yum on "/usr/lib64/python2.7/site-packages"

I added the above path to PYTHONPATH and its not recognizing when run as 
ordinary user.

But when run through sudo cmd its working. But due to lower Python 2.7.5, it 
fails.

I ran like:

sudo python test.py


2. My main requirement is to test things from Python 2.7.14.
Also I installed python 2.7.14 in /usr/local/bin.

When I try to use /usr/local/bin/python it fails to import google protobuf 
installed through yum.

sudo PYTHONPATH=/usr/lib64/python2.7/site-packages /usr/local/bin/python test.py


Re-installing protobuf also does not help.

3. For this purpose, When I don't use yum and build protobuf from src code, 
added /usr/local/include to PYTHONPATH (where google.protobuf present), it 
still import fails.

"from google.protobuf import *" or import google.protobuf fails.



Appreciate inputs.

Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-list