473,666 Members | 2,208 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with single-quote and double-quote when using subprocess.

Hello -

i'm trying to call subprocess.pope n on the 'command-based' function in
linux. When I run the command from the shell, like so:

goset -f ' "%s %s" name addr ' file_name

it works fine

however when I try to do it in python like so:

p = subprocess.Pope n(["goest",'-f \'\"%s %s\" name addr\' ',
'file_name'], shell=True)

It always failed.

I also try like so:

p = subprocess.Pope n(["goest","-f '\"%s %s\" name addr' ",
'file_name'], shell=True)

It also failed.

Does anybody have a good suggestion for this matter? thanks in
advance.

Evan
Nov 3 '08 #1
3 6515
On Nov 4, 8:47*am, Evan <xdi...@gmail.c omwrote:
It always failed.
It also failed.
Does anybody have a good suggestion for this matter? thanks in
advance.
What do you mean by "it failed"? It always helps to paste the actual
error message you received.
Nov 4 '08 #2
On Nov 3, 10:47*pm, Evan <xdi...@gmail.c omwrote:
Hello -

i'm trying to call subprocess.pope n on the 'command-based' function in
linux. *When I run the command from the shell, like so:

goset -f ' "%s %s" name addr ' file_name

it works fine

however when I try to do it in python like so:

p = subprocess.Pope n(["goest",'-f \'\"%s %s\" name addr\' ',
'file_name'], shell=True)

It always failed.

I also try like so:

p = subprocess.Pope n(["goest","-f '\"%s %s\" name addr' ",
'file_name'], shell=True)

It also failed.

Does anybody have a good suggestion for this matter? thanks in
advance.
It looks like there are _4_ items on the command line:

goset
-f
' "%s %s" name addr '
file_name

so the call should be:

p = subprocess.Pope n(["goest", "-f", "' \"%s %s\" name addr '",
"file_name"], shell=True)

(Untested)
Nov 4 '08 #3
On Tue, 04 Nov 2008 03:26:21 -0800, MRAB wrote:
On Nov 3, 10:47Â*pm, Evan <xdi...@gmail.c omwrote:
>i'm trying to call subprocess.pope n on the 'command-based' function in
linux. Â*When I run the command from the shell, like so:

goset -f ' "%s %s" name addr ' file_name

it works fine

It looks like there are _4_ items on the command line:

goset
-f
' "%s %s" name addr '
file_name

so the call should be:

p = subprocess.Pope n(["goest", "-f", "' \"%s %s\" name addr '",
"file_name"], shell=True)
The argument after '-f' doesn't have the single quotes at both ends.
They tell the shell that it is just one argument and the shell removes
them before calling ``goset`` (or ``goest``).

Ciao,
Marc 'BlackJack' Rintsch
Nov 4 '08 #4

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

Similar topics

8
7151
by: L Major | last post by:
Hi Unfortunately, I am limited to using tables for part of my current project. I have a form that spans across a number of TR and TD in the shape of checkboxes. Doctype is XHTML 1.0 Transitional, Encoding is utf-8 Is there anything wrong? Should I try something else? What in that case?
117
7176
by: Peter Olcott | last post by:
www.halting-problem.com
15
3611
by: Hemant Shah | last post by:
Folks, We have an SQL statement that was coded in an application many years ago (starting with DB V2 I think). When I upgraded to UDB 8.2, the optimizer does not use optimal path to access the data. It takes about 4 minutes to get the data. In previous versions it was instantaneous. What do I need to do to increase the performance?
15
3822
by: Andrew Maclean | last post by:
I guess this problem can be distilled down to: How do I search through a string, find the first matching substring, replace it, and continue through the string doing this. Can replace_if() be used to do this? Here is a concrete example: If I have a string with sequences of CRLF and possibly just CR's, is there a simple way of replacing the CRLF characters with a LF? If you look at the function below is it possible to use a replace_if...
9
2120
by: Ed Gonen | last post by:
Hi, I have the following problem. I've created 2 WebServices (A and B) that reference to the same assembly - Credentials. Each WebService (A and B) expose method GetCredentials that returns the Credentials class. public class ServiceA : System.Web.Services.WebService { public Credentials GetCredentials() {
3
2051
by: Joe Fawcett | last post by:
Dear All We have an application where users login, their name/password details are stored in a table, and now we want to add a third party bulletin board that lives in its own virtual directory. Both applications are running on the same IIS. How do we authenticate users so that they don't have to sign in again without passing their name and password in the querystring or request header? The login details are the same for both...
5
2252
by: Jason | last post by:
I am having a rounding problem in a value i am trying to display in VB.NET. If I have the following code: Dim x As Single = 2726.795 Dim y As Single = Math.Round(2726.795, 2) Dim s as String = String.Format("{0:0.00}", y) The value of s is 2726.79 If I have the following code: Dim y As Single = Math.Round(2726.795, 2)
4
2045
by: Keeper | last post by:
class object (COM-object) return dimension "System.Single". problem: Object o; // object = VARIANT o = comclass.GetData(); Single dm = (Single) o; // Error, problem convertation Help!!!
36
4769
by: beebelbrox | last post by:
Hi, I am new VB programming in Access and I am requesting help with the following code. WIndows OS MSaccess 2003 This code is attached to an unbound form that will display a specific recordset based in information passed to the form from another form. The problem I am having is that for each of the case statements the proper records (values and Number of records) are being returned but the movement commands do not work or do not display...
0
1287
by: boeledi | last post by:
I'm new in GDI programming and I am facing the following problem. I try to dynamically create "thumbnail"-like images (JPEG) in which I need to draw text. This works fine, except that the text is always a little bit "blurred". Here is the code, could someone give me some help? Thanks in advance, Didier Public Shared Function AppropriateFont(ByVal g As Graphics, ByVal
0
8443
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8639
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7385
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6192
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2769
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1772
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.