473,395 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

String operations

Hi. I'm trying to resolve an issue with strings.

The command(inclusive of the back-slashes)

condor_q -l -constraint "ProjectId==\"anoopr_samadams.fnal.gov_161903_3020 9\""

is the only way the command returns the right result.
I'm trying to run this command from inside a python program.
The way I can get it work is by:

os.system('condor_q -l -constraint "ProjectId==\\\"anoopr_samadams.fnal.gov_161903_30 209\\\""')

But, I'd rather use the os.exec functions to get the output. But

os.execvp("condor_q",["condor_q","-l","-constraint",'"ProjectId==\\\"anoopr_samadams.fnal. gov_161903_30209\\\""'])

doesnt work. Its definately a problem with one of the million
backslashes and quotes present, but I'm not able to figure it out.
What am I doing wrong?

Thanks,
Anoop ///
________________________________________________
The happiest time of a person's life is after his first divorce.
-- J.K. Galbraith
Jul 18 '05 #1
1 1784
Anoop Rajendra wrote:
Hi. I'm trying to resolve an issue with strings.

The command(inclusive of the back-slashes)

condor_q -l -constraint "ProjectId==\"anoopr_samadams.fnal.gov_161903_3020 9\""

is the only way the command returns the right result.
I'm trying to run this command from inside a python program.
The way I can get it work is by:

os.system('condor_q -l -constraint "ProjectId==\\\"anoopr_samadams.fnal.gov_161903_30 209\\\""')

But, I'd rather use the os.exec functions to get the output. But

os.execvp("condor_q",["condor_q","-l","-constraint",'"ProjectId==\\\"anoopr_samadams.fnal. gov_161903_30209\\\""'])

doesnt work. Its definately a problem with one of the million
backslashes and quotes present, but I'm not able to figure it out.
What am I doing wrong?

I believe that you don't need to escape the quotes inside the argument
strings when you call os.execvp(), because there's no shell interpreting
the arguments. So, in theory, what you appear to need would be

os.execvp("condor_q",["condor_q","-l","-constraint",'ProjectId=="anoopr_samadams.fnal.gov_ 161903_30209"'])

or even, since I don't see the need for the quotes in the first place,

os.execvp("condor_q",["condor_q","-l","-constraint",'ProjectId==anoopr_samadams.fnal.gov_1 61903_30209'])

or

os.execvp("condor_q",["condor_q","-l","-constraint","ProjectId==anoopr_samadams.fnal.gov_1 61903_30209"])

regards
Steve
--
http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Oliver S. | last post by:
I've developed a string-class that holds the string in an array which is a member-variable of the class and that has maximum-size which is con- figurable through a template-parameter. If any...
10
by: cmk128 | last post by:
Hi I am going to implement a new string class for my os, do you have any idea to enhance of standard c++ string class? If compare c++ string class with CS++ CString class and java String class,...
32
by: Wolfgang Draxinger | last post by:
I understand that it is perfectly possible to store UTF-8 strings in a std::string, however doing so can cause some implicaions. E.g. you can't count the amount of characters by length() | size()....
17
by: Chad Myers | last post by:
I've been perf testing an application of mine and I've noticed that there are a lot (and I mean A LOT -- megabytes and megabytes of 'em) System.String instances being created. I've done some...
2
by: Dan Schumm | last post by:
I'm relatively new to regular expressions and was looking for some help on a problem that I need to solve. Basically, given an HTML string, I need to highlight certain words within the text of the...
29
by: zoro | last post by:
Hi, I am new to C#, coming from Delphi. In Delphi, I am using a 3rd party string handling library that includes some very useful string functions, in particular I'm interested in BEFORE (return...
23
by: comp.lang.tcl | last post by:
I have a TCL proc that needs to convert what might be a list into a string to read consider this: ]; # OUTPUTS Hello World which is fine for PHP ]; # OUTPUT {{-Hello}} World, which PHP...
6
by: arnuld | last post by:
This works fine, I welcome any views/advices/coding-practices :) /* C++ Primer - 4/e * * Exercise 8.9 * STATEMENT: * write a program to store each line from a file into a *...
25
by: Bala2508 | last post by:
Hi, I have a C++ application that extensively uses std::string and std::ostringstream in somewhat similar manner as below std::string msgHeader; msgHeader = "<"; msgHeader += a; msgHeader...
3
by: yogi_bear_79 | last post by:
I'm sure I have a few things wrong here. But I am stuck on how to do a recurring search. Also my statement cin >quote; acts weird. If I enter more than one word it blows right past cin >findMe;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.