Re: Mutability of function arguments?

2005-12-07 Thread Mark Tolonen
ex_ottoyuhr [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm trying to create a function that can take arguments, say, foo and bar, and modify the original copies of foo and bar as well as its local versions -- the equivalent of C++ funct(foo, bar). I've looked around on this

Re: Any way to not create .pyc files?

2005-06-09 Thread Mark Tolonen
Lonnie Princehouse [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] In short: Is there any way to run Python WITHOUT trying to create .pyc files (or .pyo) or to have Python not attempt to import the .pyc files it finds? Reason: We have a site-specific package installed on a

Re: Embedding Python

2005-03-26 Thread Mark Tolonen
Markus Franz [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi! I wanted to run some Python code from inside a C program, so I did it like it was explained in the Python manual: #include Python.h int main(int argc, char *argv[]) { Py_Initialize(); PyRun_SimpleString(print

Re: Embedding Python

2005-03-26 Thread Mark Tolonen
Diez B. Roggisch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] This works for me on Redhat 9: g++ x.cpp -o x -I/usr/include/python2.2 -pthread -lm -ldl -lutil /usr/lib/python2.2/config/libpython2.2.a Why did you chose the static variant? This should be equivalent: g++

Re: Embedding Python

2005-03-26 Thread Mark Tolonen
Reinhold Birkenfeld [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Heiko Wundram wrote: Am Samstag, 26. März 2005 20:43 schrieb Mark Tolonen: On my system, for whatever reason, the .so library isn't present. I have the python-devel package installed. I actually can't believe

Re: brain stuck. whats occurring here?

2008-02-07 Thread Mark Tolonen
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hallo, I'm after [[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]],[[],[],[],[],[]]] How about: [[[]]*5]*5 [[[], [], [], [], []], [[], [], [], [], []], [[], [], [], [], []], [[], [], [], [], []], [[], [], [],

Re: Chinese character error

2008-02-08 Thread Mark Tolonen
Chris [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Feb 8, 11:29 am, John Deas [EMAIL PROTECTED] wrote: Hi, I made a small script to recursively copy files from a directory tree to an exportDir only if they have an mp3 extension : a=os.walk(os.getcwd()) for root, dirs,

Re: Command line arguments in Windows

2008-03-03 Thread Mark Tolonen
Mike Walker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] If you run a python file, ie. just double clicking it the only argument you will have will be the filename of the script. If you create a shortcut to the script and in the target box add your arguments (if you have

Re: help needed with regex and unicode

2008-03-03 Thread Mark Tolonen
Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Tue, 04 Mar 2008 10:49:54 +0530, Pradnyesh Sawant wrote: I have a file which contains chinese characters. I just want to find out all the places that these chinese characters occur. The following script

Re: struct unpack

2008-03-17 Thread Mark Tolonen
brnstrmrs [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] If I run: testValue = '\x02\x00' junk = struct.unpack('h', testValue) Everything works but If I run testValue = raw_input(Enter Binary Code..:) inputting at the console '\x02\x00' junk = struct.unpack('h', testValue)

Re: Receive data from socket stream

2008-04-27 Thread Mark Tolonen
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Apr 26, 7:25 am, Irmen de Jong [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Until now, I've been doing this little trick: data = client.recv(256) new = data while len(new) == 256: new = client.recv(256) data +=

Re: Using the indent method

2008-05-14 Thread Mark Tolonen
dj [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello All, I am using elementtree to write an XML document and I am having a hard time adding the correct indentation. I have tried using the indent method, but I can not figure out how to use it. Any suggestions. Using the

Re: getting at individual bits inside byte field: struct module : bitwise operator

2009-02-23 Thread Mark Tolonen
harijay hari...@gmail.com wrote in message news:4c7d58a1-830f-4f02-ba07-aa4910f5f...@b16g2000yqb.googlegroups.com... In my last post I had asked about reading data from a binary file using the struct module. Thanks to some excellent help , I have managed to read in successfully most of the

Re: Problem in accessing files with unicode fonts.

2009-02-23 Thread Mark Tolonen
Try os.walk for recursively walking directories. Also if you use a unicode parameter with os.walk or os.listdir you get unicode strings in the result. To run this successfully when you have non-ascii characters in your filenames, you will need to use an environment that supports the

Re: Iterator class to allow self-restarting generator expressions?

2009-03-01 Thread Mark Tolonen
John O'Hagan resea...@johnohagan.com wrote in message news:200903011520.29405.resea...@johnohagan.com... Inspired by some recent threads here about using classes to extend the behaviour of iterators, I'm trying to replace some some top-level functions aimed at doing such things with a class.

Re: how to convert from network to host byte order

2009-03-05 Thread Mark Tolonen
Evan xdi...@gmail.com wrote in message news:79582a34-5d0b-49b2-8c1e-4139324ff...@b38g2000prf.googlegroups.com... Hello ~ I'm new with python, what my problem is, I have a binary file, I want to read first 2 bytes and convert it to host byte order, then write it to another file. There is a

Re: Stopping SocketServer on Python 2.5

2009-03-10 Thread Mark Tolonen
David George d...@eatmyhat.co.uk wrote in message news:00150e67$0$27956$c3e8...@news.astraweb.com... Hi guys, I've been developing some code for a university project using Python. We've been working on an existing codebase, cleaning it up and removing dead wood. We decided to make some

Re: Stopping SocketServer on Python 2.5

2009-03-12 Thread Mark Tolonen
Falcolas garri...@gmail.com wrote in message news:1b6a95a4-5680-442e-8ad0-47aa9ea08...@w1g2000prk.googlegroups.com... On Mar 11, 1:11 pm, David George d...@eatmyhat.co.uk wrote: Again, problem here is the issue of being unable to kill the server while it's waiting on a request. In theory, i

Re: PyWin32 for Python 3.x

2009-03-16 Thread Mark Tolonen
cgoldberg cgoldb...@gmail.com wrote in message news:6047c263-c6cb-4357-ad9b-96b61ec7e...@j8g2000yql.googlegroups.com... Release 213 is out already: Tim, Mark, this is great news.. thanks for tracking 3.x so closely. I big barrier for me to eventually adopt 3.x is the ability to use pywin32.

Re: meta question - how to read comp.lang.python w/o usenet feed/google interface?

2009-03-20 Thread Mark Tolonen
Esmail ebo...@gmail.com wrote in message news:03081704-17b5-4c7d-82db-8efb7ebce...@q11g2000yqh.googlegroups.com... Hi all, I've been reading/posting to usenet since the 80s with a variety of tools (vn, and most recently Thunderbird) but since my ISP (TimeWarner) no longer provides usenet

Re: Generators/iterators, Pythonicity, and primes

2009-04-04 Thread Mark Tolonen
John Posner jjpos...@snet.net wrote in message news:af9fbcc3a7624599a6f51bad2397e...@amdup... Inspired by recent threads (and recalling my first message to Python edu-sig), I did some Internet searching on producing prime numbers using Python generators. Most algorithms I found don't go for

Re: Regex similar to ^(?u)\w$, but without digits?

2009-04-11 Thread Mark Tolonen
Andreas a.pfren...@gmail.com wrote in message news:f953c845-3660-4bb5-8ba7-00b93989c...@b1g2000vbc.googlegroups.com... Hello, I'd like to create a regex that captures any unicode character, but not the underscore and the digits 0-9. ^(?u)\w$ captures them also. Is there a possibility to

Re: regex for multiple whitespace-only lines

2009-04-12 Thread Mark Tolonen
Phil Mayes oliv...@olivebr.com wrote in message news:5.2.1.1.0.20090412194731.013d0...@olivebr.com... I am trying to search for 1 or more empty or white-space-only lines. Empty lines work: re.compile('(?m)(^$){1,2}') _sre.SRE_Pattern object at 0x010F9218 One line with possible whitespace

Re: Regex similar to ^(?u)\w$, but without digits?

2009-04-12 Thread Mark Tolonen
Andreas Pfrengle a.pfren...@gmail.com wrote in message news:26d3bec3-8329-4432-a680-05c17f930...@3g2000yqk.googlegroups.com... On 12 Apr., 02:31, Mark Tolonen metolone+gm...@gmail.com wrote: Andreas a.pfren...@gmail.com wrote in message news:f953c845-3660-4bb5-8ba7-00b93989c

Re: How to access C structures

2009-04-16 Thread Mark Tolonen
Chris Helck chris.he...@us.icap.com wrote in message news:6db873c2999f7547ad0d1c0e6f0c89d704285...@uspsexchs1.us.icap.com... I have a couple dozen C structures that define binary file records. I need to read the file and access the records. I need to do this very efficiantly. I am aware of

Python 3.0 and repr

2008-09-28 Thread Mark Tolonen
I don't understand the behavior of the interpreter in Python 3.0. I am working at a command prompt in Windows (US English), which has a terminal encoding of cp437. In Python 2.5: Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win 32 Type help,

Re: Music knowledge representation

2008-09-28 Thread Mark Tolonen
Mr.SpOOn [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Sun, Sep 28, 2008 at 8:59 PM, Aaron Castironpi Brady [EMAIL PROTECTED] wrote: Here is a link to someone else's design they asked about on the newsgroup a couple weeks ago.

Re: Python 3.0 and repr

2008-09-28 Thread Mark Tolonen
Martin v. Löwis [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] What are others' opinions? Any insight to this design decision? The intention is that all printable characters in a string get displayed in repr. This was in particular requested by Japanese users (but also by other

Re: Using re to find unicode ranges

2008-09-29 Thread Mark Tolonen
Eric Abrahamsen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is it possible to use the re module to find runs of characters within a certain Unicode range? I'm writing a Markdown extension to go over text and wrap blocks of consecutive Chinese characters in span

Re: How to emit UTF-8 from console mode?

2008-10-01 Thread Mark Tolonen
Martin v. Löwis [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] LC_CTYPE=en_US.UTF-8 urxvt-X.exe perl -wle binmode STDOUT, q[:utf8]; print chr() for 0x410 .. 0x430; Can someone help me translate it into python? LC_CTYPE=en_US.UTF-8 urxvt-X.exe python -c 'for i in range(0x410,

Re: How to emit UTF-8 from console mode?

2008-10-01 Thread Mark Tolonen
Ross Ridge [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I need UTF-8 because I need to experiment with some OS function calls that give me UTF-16 and I need to emit UTF-16 or UTF-8. [EMAIL PROTECTED] wrote: Try setting the code page to 65001, and emit the UTF-8 explicitly.

Re: How to emit UTF-8 from console mode?

2008-10-01 Thread Mark Tolonen
Siegfried Heintze [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Make sure you are using the Lucida Console font for the cmd.exe window and type the commands: chcp 1251 python -c print ''.join(unichr(i) for i in range(0x410,0x431)) Output: ?

Re: Socket Question

2008-10-01 Thread Mark Tolonen
Ali Hamad [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello All : A socket question from a networking newbie. I need to create a server that: 1) receive a message from client. 2) check that message and response to it. 3) the client get the server message and send another

Re: unicode .replace not working - why?

2008-10-12 Thread Mark Tolonen
In your original code: textu.replace(unichr(167),'\n') as Dennis suggested (but maybe you were distracted by his 'fn' replacement, so I'll leave it out): textu = textu.replace(unichr(167),'\n') .replace does not modify the string in place. It returns the modified string, so you have

Re: Unicode File Names

2008-10-18 Thread Mark Tolonen
Jordan [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] l = os.listdir(unicode(os.getcwd())) Other options to get the same result: l = os.listdir(os.getcwdu()) l = os.listdir(u'.') Oddly, os.getcwd() and os.getcwdu() both still exist in Python 3.0. Since the behavior is now

Re: Unicode File Names

2008-10-18 Thread Mark Tolonen
Martin v. Löwis [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Oddly, os.getcwd() and os.getcwdu() both still exist in Python 3.0. Since the behavior is now identical it seems os.getcwdu() should be dropped. It is dropped, and os.getcwdb() has been added. Must be changed post

Re: how to call this dll in python

2008-11-03 Thread Mark Tolonen
Shark [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have a windows dll1.dll with a export function: int f1(char filename,char **buf,int *bufLen) { int len; //got the length of file anyway,such as 100 len = 100;//len = getLen(filename); *buf = (char*)calloc(100); *bufLen = len;

Re: convert binary to float

2008-06-01 Thread Mark Tolonen
George Sakkis [EMAIL PROTECTED] wrote in message news:829b1e8f-baac-4ff4-909b-[EMAIL PROTECTED] On Jun 1, 3:55 pm, Mason [EMAIL PROTECTED] wrote: I have tried and tried... I'd like to read in a binary file, convert it's 4 byte values into floats, and then save as a .txt file. This works from

Re: pythton 调用 so 共享库不能转换参数类型

2008-06-03 Thread Mark Tolonen
windwiny [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] 我初学python 的 ctypes, 现在的环境是 ubuntu 8.04, Python 2.5.2 (r252:60911, May 7 2008, 15:19:09) , gcc (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu7) 我创建了一个 so 共享库 - #include math.h double myfd(double x) { return x * 2;}

Re: ctypes help

2008-06-06 Thread Mark Tolonen
gianluca [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] hy, I've a huge problem with ctypes. I've compiled my C library and I'd like use it in python with ctype. One function need to pass a pointer to typed ( like this: typedef int value_type). In python I can access to that funtion

Re: Parsing a path to components

2008-06-07 Thread Mark Tolonen
eliben [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Jun 7, 10:15 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Fri, 06 Jun 2008 23:57:03 -0700, s0suk3 wrote: You can just split the path on `os.sep', which contains the path separator of the platform on which Python

Re: time module methods give an am or pm value ?

2008-06-07 Thread Mark Tolonen
dj [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello again, Does anyone know which method in the time module will generate and am or pm ? If none of the method will do this for me. Can I produce the value on my own ? Any suggestions ? from time import * strftime('%I:%M:%S

Re: How to get full path to script?

2008-06-08 Thread Mark Tolonen
kj [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] How can a script know its absolute path? (__file__ only gives the path it was used to invoke the script.) Basically, I'm looking for the Python equivalent of Perl's FindBin. The point of all this is to make the scripts location

Re: Iterate creating variables?

2008-06-16 Thread Mark Tolonen
Hyuga [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Jun 13, 11:34 am, Reedick, Andrew [EMAIL PROTECTED] wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:python- [EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Friday, June 13, 2008 11:11 AM To:

Re: Accent character problem

2008-06-20 Thread Mark Tolonen
Sallu [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all and one i wrote this script, working fine without fail( just run it) import re value='This is Praveen' print value #value = 'riché gerry' #words=str(value.split()).strip('[]').replace(', ', '') ( here i tried to convert in

Re: Question: How do I format printing in python

2008-06-23 Thread Mark Tolonen
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi All, How do I format printed data in python? I could not find this in the Python Reference Manual: http://docs.python.org/ref/print.html Nor could I find it in Matloff's great tutorial:

Re: String question

2008-06-23 Thread Mark Tolonen
Andreu [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Yes, ... don't ask me why, but in fact v1,v2,v3 = str1.split() does not seem to work. My original problem was I forgot about the parenthesis as Tim point out. So I ended up converting to a list as in: v = str1.split() and

Re: Getting sorting order

2008-06-30 Thread Mark Tolonen
leodp [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Or provide a better explanation and an example. Do you mean something like this? Hi Peter, a small example: master=[1,4,3,2] slave1=['d','c','b','a'] slave2=[1,2,3,4] master.sort() # this is ok, but does not return infos

Re: ctypes - swig - pointer

2008-06-30 Thread Mark Tolonen
gianluca [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On 30 Giu, 18:26, Jean-Paul Calderone [EMAIL PROTECTED] wrote: On Mon, 30 Jun 2008 09:13:42 -0700 (PDT), gianluca [EMAIL PROTECTED] wrote: I've a problem with dll function colled with python/ctypes. My functions (C) requred a

Re: The Yield statement

2008-07-06 Thread Mark Tolonen
inhahe [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Alex Bryan [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Okay, so i don't really understand the Yield thing and i know it is useful. I've read a few things about it but it is all programming jargon and so

Re: how are strings immutable in python?

2008-07-06 Thread Mark Tolonen
ssecorp [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] so if strings were mutable and i did a = b = foo and then did a += bar then a and b would be foobar? This can be demonstrated with a list of characters, which *is* mutable: a = b = list('foo') a += list('bar') a ['f', 'o',

Re: Python pack and unpack question

2008-07-15 Thread Mark Tolonen
joe shoemaker [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] If you have the following: data = unpack('L', sock.recv(4)) Does this line of code means that incoming data is big endian and unpack it to endianess of local machine? If local machine is little endian, then big

Re: Unicode confusion

2008-07-15 Thread Mark Tolonen
Jerry Hill [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Mon, Jul 14, 2008 at 12:40 PM, Tim Cook [EMAIL PROTECTED] wrote: if I say units=unicode(°). I get UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 0: ordinal not in range(128) If I try

Re: Exceptions - How do you make it work like built-in exceptions?

2008-01-13 Thread Mark Tolonen
Lie [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] A built-in exceptions, when raised, would print traceback that points out the offending code, like this: Traceback (most recent call last): File F:\dir\code.py, line 43, in module a = 1/0 --- ZeroDivisionError: integer

Re: handlers.SocketHandler and exceptions

2008-01-16 Thread Mark Tolonen
writeson [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all, On our Linux systems at work I've written a Twisted logging server that receives log messages from multiple servers/processes to post them to a log file, essentially serializing all the process log messages. This

Re: regular expression negate a word (not character)

2008-01-25 Thread Mark Tolonen
Summercool [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] somebody who is a regular expression guru... how do you negate a word and grep for all words that is tire but not snow tire or snowtire so for example, it will grep for winter tire tire retire tired

Re: Beginner String formatting question

2008-01-26 Thread Mark Tolonen
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi all, I am trying to write a simple program that will accept an integral time input in the HHMMSS format and output a HH:MM:SS form. My code is as follows: import string def FormatTime(time):

Re: REALLY simple xml reader

2008-01-27 Thread Mark Tolonen
Simon Pickles [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi Can anyone suggest a really simple XML reader for python? I just want to be able to do something like this: xmlDoc = xml.open(file.xml) element = xmlDoc.GetElement(foo/bar) ... to read the value of: foo

Re: Some questions about decode/encode

2008-01-27 Thread Mark Tolonen
John Machin [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Jan 27, 9:17 pm, glacier [EMAIL PROTECTED] wrote: On 1月24日, 下午3时29分, Gabriel Genellina [EMAIL PROTECTED] wrote: *IF* the file is well-formed GBK, then the codec will not mess up when decoding it to Unicode. The usual

Re: strftime return value encoding (mbcs, locale, etc.)

2008-01-27 Thread Mark Tolonen
Giovanni Bajo [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I am trying to find a good way to portably get the output of strftime() and put it onto a dialog (I'm using PyQt, but it doesn't really matter). The problem is that I need to decode the byte stream returned by

Re: small problem with re.sub

2008-01-30 Thread Mark Tolonen
Astan Chee [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I have a html text stored as a string. Now I want to go through this string and find all 6 digit numbers and make links from them. Im using re.sub and for some reason its not picking up the previously matched

Re: getting with statement to deal with various exceptions

2008-07-20 Thread Mark Tolonen
mk [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I'm trying to learn how with statement can be used to avoid writing: prepare() try: something_that_can_raise_SomeException() except SomeException, err: deal_with_SomeException finally: tear_it_down() Verbose, not very

Re: imported module no longer available

2008-07-21 Thread Mark Tolonen
Jeff Dyke [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I've come across an error that i'm not yet able to create a test case for but wanted to get see if someone could shed light on this. I have imported a module at the top of my file with import mymodulename this module is used

Re: ctypes and reading value under pointer passed as param of a callback

2008-07-25 Thread Mark Tolonen
waldek [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Jul 24, 5:01 pm, Thomas Heller [EMAIL PROTECTED] wrote: waldekschrieb: Hi, I'm using C dll with py module and wanna read value (buffer of bytes) returned in py callback as parameter passed to dll function. The callback

Re: How to print first(national) char from unicode string encoded inutf-8?

2008-09-01 Thread Mark Tolonen
Marco Bizzarri [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Mon, Sep 1, 2008 at 3:25 PM, [EMAIL PROTECTED] wrote: When I do ${urllib.unquote(c.user.firstName)} without encoding to latin-1 I got different chars than I will get: no Łukasz but Å ukasz --

Re: Very simple - please help

2008-11-07 Thread Mark Tolonen
Chris Rebert [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Fri, Nov 7, 2008 at 8:52 PM, pineapple [EMAIL PROTECTED] wrote: I am not a python programmer, but am being forced to port one of my (smalltalk) applications to python for pragmatic reasons (python is embedded with a

Re: Where to locate existing standard encodings in python

2008-11-09 Thread Mark Tolonen
News123 [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I was googling quite some time before finding the answer to my question: 'what are the names for the encodings supported by python?' I found the answer at http://python.active-venture.com/lib/node127.html Now my

Re: SocketServer.ThreadingTCPServer accepts clients outside server_forever

2008-11-09 Thread Mark Tolonen
Okko Willeboordse [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, SocketServer.ThreadingTCPServer accepts connections (clients can connect) before and after it's server_forever method is called, see below for an example. IMHO it should only accept connections while

Re: Identifying unicode punctuation characters with Python regex

2008-11-14 Thread Mark Tolonen
Shiao [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I'm trying to build a regex in python to identify punctuation characters in all the languages. Some regex implementations support an extended syntax \p{P} that does just that. As far as I know, python re doesn't. Any idea

Re: Identifying unicode punctuation characters with Python regex

2008-11-14 Thread Mark Tolonen
Mark Tolonen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Shiao [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I'm trying to build a regex in python to identify punctuation characters in all the languages. Some regex implementations support an extended syntax

Re: Windows PE and Python 2.6 (Side-by-Side error)

2008-11-14 Thread Mark Tolonen
Werner Merkl [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hallo, I like Python 2.6 and I like to use it anywhere, even within Windows PE. In former version of Python (= 2.5.x) it was easy to bring it to a Windows PE system: Install Python to Windows XP or Vista and (robo-) copy

Re: ElementTree XML Namspace

2008-11-14 Thread Mark Tolonen
Hunter [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] We are reviewing a vendor who will output some data in an XML format. I will then use python to convert the data to another format for upload to another vendor. I'm having trouble with very basic steps with the sample file they

Re: Newbie code review of parsing program Please

2008-11-16 Thread Mark Tolonen
len [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have created the following program to read a text file which happens to be a cobol filed definition. The program then outputs to a file what is essentially a file which is a list definition which I can later copy and past into a

Re: Newbie code review of parsing program Please

2008-11-17 Thread Mark Tolonen
Steve Holden [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Mark Tolonen wrote: len [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] [...] You might want to check out the pyparsing library. And you might want to trim your messages to avoid quoting irrelevant stuff

Re: A little comments of ctypes and construct.

2008-11-21 Thread Mark Tolonen
一首诗 [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I didn't try your code. That might be working since it a completely different method. What mean is pack works: = class POINT(Structure): _fields_ = [('x', c_int), ('y', c_int)] p = POINT(1,2) p.x,

Re: matching exactly a 4 digit number in python

2008-11-21 Thread Mark Tolonen
harijay [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I want to parse a number of strings and extract only those that contain a 4 digit number anywhere inside a string Try: p = re.compile(r'\b\d{4}\b') -Mark -- http://mail.python.org/mailman/listinfo/python-list

Re: [2.5.1] ShiftJIS to Unicode?

2008-11-27 Thread Mark Tolonen
Gilles Ganault [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Thu, 27 Nov 2008 01:00:28 +, MRAB [EMAIL PROTECTED] wrote: No problem here: import urllib data = urllib.urlopen(http://www.amazon.co.jp/;).read() decoded_data = data.decode(shift-jis) This is correct. You

Re: generating a liste of characters

2008-12-05 Thread Mark Tolonen
Yves Dorfsman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there any built in way to generate a list of characters, something along the line of range('a'-'z') ? Right now I am using: chars = [ chr(l) for l in range(0x30, 0x3a) ] # 0 - 9 chars += [ chr(l) for l in

Re: generating a liste of characters

2008-12-05 Thread Mark Tolonen
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Mark Tolonen: Writing a helper function reduces code repetition and improves readability: def crange(startch,endch): '''Return a list of characters from startch to endch, inclusive.''' return [chr(c) for c in xrange(ord(startch),ord

Re: A more pythonic way of writting

2008-12-05 Thread Mark Tolonen
eric [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] def flag(IGNORECASE=False, LOCALE=False, MULTILINE=False, DOTALL=False, UNICODE=False, VERBOSE=False): vals = [IGNORECASE, LOCALE, MULTILINE, DOTALL, UNICODE, VERBOSE] filtered = map( lambda m:m[1],filter( lambda m: m[0],

Re: pretty strange behavior of strip

2008-12-05 Thread Mark Tolonen
Guy Doune [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Ok, didn't show the whole problem... I will read the doc anyway, but why questions.html keep it t?? test=['03.html', '06.html', 'questions.html', '04.html', 'toc.html', '01.html', '05.html', '07.html', '02.html',

Re: pretty strange behavior of strip

2008-12-05 Thread Mark Tolonen
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Thu, 4 Dec 2008 at 20:54, Terry Reedy wrote: [snip] I have often wished that in 'split' I could specify a _set_ of characters on which the string would be split, in the same way the default list of whitespace characters causes a

Re: Python 3.0 automatic decoding of UTF16

2008-12-06 Thread Mark Tolonen
Johannes Bauer [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] John Machin schrieb: On Dec 6, 5:36 am, Johannes Bauer [EMAIL PROTECTED] wrote: So UTF-16 has an explicit EOF marker within the text? I cannot find one in original file, only some kind of starting sequence I suppose

Re: operators as variables

2008-12-06 Thread Mark Tolonen
macc_200 [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, just starting programming and have an elementary question after playing around with lists but cannot find the answer with googling. I have a list of variables and I would like some of those variables to be integers and

Re: Python 3.0 crashes displaying Unicode at interactive prompt

2008-12-13 Thread Mark Tolonen
John Machin sjmac...@lexicon.net wrote in message news:a8cd683f-853d-4665-bee4-7a0bdb841...@c36g2000prc.googlegroups.com... On Dec 14, 9:20 am, Martin v. Löwis mar...@v.loewis.de wrote: This is intended behavior. I see. That means that the behaviour in Python 1.6 to 2.6 (i.e. encoding

Re: How to display Chinese in a list retrieved from database via python

2008-12-25 Thread Mark Tolonen
zxo102 zxo...@gmail.com wrote in message news:979fdf6d-0500-47ba-87fd-0f0361ca3...@p2g2000prf.googlegroups.com... On 12月26日, 上午4时58分, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Thu, 25 Dec 2008 07:27:03 -0200, zxo102 zxo...@gmail.com escribió: On 12月25日, 下午3时35分, Chris Rebert

Re: ctypes strings

2008-12-27 Thread Mark Tolonen
Hendrik van Rooyen m...@microcorp.co.za wrote in message news:000f01c96822$5c300f00$0d00a...@hendrik... Red Rackham wrote: I would like to pass a string into a dll function. I notice that to pass using ctypes, it has to be a ctypes type. Looking at the ctypes doc page I don't see a

Re: How to display Chinese in a list retrieved from database via python

2008-12-29 Thread Mark Tolonen
zxo102 zxo...@gmail.com wrote in message news:2560a6e0-c103-46d2-aa5a-8604de4d1...@b38g2000prf.googlegroups.com... I have a list in a dictionary and want to insert it into the html file. I test it with following scripts of CASE 1, CASE 2 and CASE 3. I can see 中文 in CASE 1 but that is not

Re: How to display Chinese in a list retrieved from database via python

2008-12-29 Thread Mark Tolonen
zxo102 zxo...@gmail.com wrote in message news:7e38e76a-d5ee-41d9-9ed5-73a2e2993...@w1g2000prm.googlegroups.com... On 12月29日, 下午5时06分, Mark Tolonen metolone+gm...@gmail.com wrote: zxo102 zxo...@gmail.com wrote in message news:2560a6e0-c103-46d2-aa5a-8604de4d1...@b38g2000prf.googlegroups.com

Re: idle 3.0 unicode

2009-01-01 Thread Mark Tolonen
Pavel Kosina g...@post.cz wrote in message news:495c7ac6.1000...@post.cz... As for unicode in Python 2.5 everything works fine in program running either in IDLE or under Command line: # -*- coding: utf-8 -*- print uěščřžýáíé In 3.0 there is an error. The same program, moved to 3.0 syntax,

Re: Nubie question: how to not pass self in call to seek() function ?

2009-01-08 Thread Mark Tolonen
Barak, Ron ron.ba...@lsi.com wrote in message news:7f0503cd69378f49be0dc30661c6ccf602494...@enbmail01.lsi.com... Hi, I am getting the error TypeError: seek() takes exactly 2 arguments (3 given), namely: $ ./_LogStream.py Traceback (most recent call last): File ./_LogStream.py, line 47,

Re: Is negative seek() from EOF of a GzipFile supported on Python 2.5.2 ?

2009-01-11 Thread Mark Tolonen
Barak, Ron ron.ba...@lsi.com wrote in message news:7f0503cd69378f49be0dc30661c6ccf602494...@enbmail01.lsi.com... The source of gzip.py on my system seems to suggest that negative seeks are supported: def seek(self, offset): if self.mode == WRITE: if offset self.offset:

Re: ctype problem

2009-01-13 Thread Mark Tolonen
Aaron Brady castiro...@gmail.com wrote in message news:6197f37d-0ea0-4430-a466-2f36b2011...@v42g2000yqj.googlegroups.com... On Jan 13, 10:22 am, Grimson grim...@gmx.de wrote: hello out there, I have a problem with c-types. I made a c-library, which expects a pointer to a self defined

Re: RegEx issues

2009-01-24 Thread Mark Tolonen
Sean Brown sbrown.h...@[spammy] gmail.com wrote in message news:glflaj$qr...@nntp.motzarella.org... Using python 2.4.4 on OpenSolaris 2008.11 I have the following string created by opening a url that has the following string in it: td[ct] = [[ ... ]];\r\n The ... above is what I'm

Re: Breaking Python list into set-length list of lists

2009-02-11 Thread Mark Tolonen
Jason elgrandchig...@gmail.com wrote in message news:8158439d-faae-4889-a1cf-8d9fee112...@v39g2000yqm.googlegroups.com... Hey everyone-- I'm pretty new to Python, I need to do something that's incredibly simple, but combing my Python Cookbook googling hasn't helped me out too much yet, and

Re: Byte type?

2009-02-15 Thread Mark Tolonen
John Nagle na...@animats.com wrote in message news:499841bf$0$1624$742ec...@news.sonic.net... Benjamin Peterson wrote: Steve Holden steve at holdenweb.com writes: Beware, also, that in 2.6 the bytes type is essentially an ugly hack to enable easier forward compatibility with the 3.X series

Re: Command parsing... best module to use?

2009-11-02 Thread Mark Tolonen
Collin D collin.da...@gmail.com wrote in message news:94dbc92b-0682-4995-b358-0c615c95a...@x6g2000prc.googlegroups.com... Hey everyone. I am writing a game in python, and it includes a text console somewhat like the one in WoW and Runescape. I want to be able to include / commands, like IRC,

Re: the unicode saga continues...

2009-11-13 Thread Mark Tolonen
Ethan Furman et...@stoneleaf.us wrote in message news:4afe4141.4020...@stoneleaf.us... So I've added unicode support to my dbf package, but I also have some rather large programs that aren't ready to make the switch over yet. So as a workaround I added a (rather lame) option to convert the

Re: Run a external program.

2009-11-14 Thread Mark Tolonen
Yasser Almeida Hernández pedro...@fenhi.uh.cu wrote in message news:20091114142611.sj45qput2c84s...@correo.fenhi.uh.cu... Hi all!! I'm writing a script where i call a external program which receive some arguments. One of this arguments is stored in a variable, that is passed as argument

Re: Calling Python functions from Excel

2009-11-17 Thread Mark Tolonen
Chris Withers ch...@simplistix.co.uk wrote in message news:4b028ac1.8020...@simplistix.co.uk... Cannonbiker wrote: Hi, unfortunately is my question about server COM (win32com) http://groups.google.com/group/comp.lang.python/browse_thread/thread/ee804cec7f58c6a7# without answer. Please I need

  1   2   >