473,659 Members | 3,395 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

text encodings -> subprocess.Pope n or -> labelmarkup (pygtk)

Hi all,

first of all, I have to say I have hardly no knowledge about that
issue.

on the program there, I have it like that:
,-------------------------------------------------------
| obj = unicode(newcomm ent, 'utf-8')
| newcomment = obj.encode('lat in-1')
|
| pipe = subprocess.Pope n(tot, stdout=subproce ss.PIPE,\
| stderr=subproce ss.PIPE, shell=False)
`---

that seems to work with that construction above.

Then I think, 'what' kind of encoding I can send to an external program,
depends also on that program? Or on the environment? If, then how could
I get that environemnt? (the programs runs also under MS windows)

Well, maybe someone has some hints about encodings issues like that, and
what I can send to external commands?

thanks a lot
calmar

--
calmar

(o_ It rocks: LINUX + Command-Line-Interface
//\
V_/_ http://www.calmar.ws
Feb 16 '06 #1
1 1387
"calmar" wrote:
Then I think, 'what' kind of encoding I can send to an external program,
depends also on that program?


the encoding is a mapping between raw bytes and their actual meaning,
and a program usually only sees the bytes, so it's entirely up to the pro-
gram to interpret what you send to it.

many programs defaults to the system's "global" default encoding for text
input; you can use the "getpreferreden coding" function in the locale module
to figure out what it is set to:

http://docs.python.org/lib/module-locale.html

</F>

Feb 16 '06 #2

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

Similar topics

3
12744
by: madpython | last post by:
playing with subprocess.Popen on Windows I stumbled into the following problem: Python 2.4.3 (#69, Mar 29 2006, 17:35:34) IDLE 1.1.3 >>> import subprocess >>> p1=subprocess.Popen("c:\\asd.bat") #works OK >>> p2=subprocess.Popen("c:\\asd.bat",stdout=subprocess.PIPE)
9
9367
by: Clodoaldo Pinto Neto | last post by:
Output from the shell: $ set | grep IFS IFS=$' \t\n' Output from subprocess.Popen(): "IFS=' \t\n" Both outputs for comparison:
13
5109
by: bayer.justin | last post by:
Hi, I am trying to communicate with a subprocess via the subprocess module. Consider the following example: <subprocess.Popen object at 0x729f0> Here hey is immediately print to stdout of my interpreter, I did not type in the "hey". But I want to read from the output into a string, so I do
12
10981
by: Eric_Dexter | last post by:
I am trying to modify a programming example and I am coming up with two problems... first is that I can't seem to pass along the arguments to the external command (I have been able to do that with the old module and cmd is the command I wish to try) all the output seems to be returned as one line (at least when I run the program in spe). import subprocess from os import system cmd = """gawk -f altertime.awk -v time_offset=4 -v
1
3981
by: Mrown | last post by:
Hi, I'm currently writing a python program that relies on a CLI program. What I'm currently doing is using subprocess.Popen on Python 2.5.1. Here's the line that I'm currently running: child = subprocess.Popen(, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) The problem is that although the above works, a CMD shell is spawned and becomes visible for each time I run the above. I thought that by
7
4915
by: skunkwerk | last post by:
Hi, i'm trying to call subprocess.popen on the 'rename' function in linux. When I run the command from the shell, like so: rename -vn 's/\.htm$/\.html/' *.htm it works fine... however when I try to do it in python like so: p = subprocess.Popen(,stdout=subprocess.PIPE,stderr=subprocess.PIPE) print p.communicate()
25
2763
by: Jeremy Banks | last post by:
Hi. I wondered if anyone knew the rationale behind the naming of the Popen class in the subprocess module. Popen sounds like the a suitable name for a function that created a subprocess, but the object itself is a subprocess, not a "popen". It seems that it would be more accurate to just name the class Subprocess, can anyone explain why this is not the case? Thank you.
1
8632
by: Mark Shewfelt | last post by:
Hello, I am attempting to use Popen() in a Windows service. I have a small Win32 .exe that I normally run through the os.popen2() function. I've written a class to work with the input and output parameters that are passed and captured from this exe. When I use the class outside of a service using either subprocess.Popen or os.popen2 work just fine. When I use this class inside a Windows service it doesn't work. It doesn't crash the...
5
4122
by: thedsadude | last post by:
Hello, I'm launching a script as follows: <code> p = subprocess.Popen() p.wait() </code> If p.py writes to sys.stdout, then it is shown on the console.
0
8428
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
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8628
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...
1
6181
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
5650
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();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
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.