Re: Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-05 Thread Dave Angel
Paul Rubin wrote: "Martin P. Hellwig" writes: Is there an advantage using shifts and masks over my kitchen type solution? Weren't you complaining about the 8-to-1 expansion from turning each bit to an ascii char? One warning to Martin: If you want your code portable across syste

Re: Datetime with float seconds

2009-08-05 Thread Hendrik van Rooyen
On Wednesday 05 August 2009 14:50:04 kpal wrote: > Hello Everybody, > > The standard datetime has 1 microsecond granularity. My application > needs finer time resolution, preferably float seconds. Is there an > alternative to the out-of-the-box datetime? Timezone support is not > essential. I am c

Re: access read / write violation with ctypes

2009-08-05 Thread Dave Angel
DH wrote: I'm using popen to capture dcraw stdout and want to pass it to magickwand. If I instead write the dcraw output to a file then read it with magickwand I get the same error. But if I comment out the dcraw protion and read the dcraw output file from the previous attempt, MagickWand opens

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-05 Thread Gabriel Genellina
En Wed, 05 Aug 2009 11:46:13 -0300, Martin P. Hellwig escribió: On several occasions I have needed (and build) a parser that reads a binary piece of data with custom structure. For example (bogus one): BE +-+-+-+-+--++ | Version | Command

Re: os.system in a service

2009-08-05 Thread Gabriel Genellina
En Wed, 05 Aug 2009 13:07:39 -0300, Lawrence Wong escribió: I wrote a program which runs a .bat file using os.system like: 'os.system(pathToBatFile)' and everything was good. Then I decided to turn my program into a service as opposed to being run with the command prompt showing. When

Re: M2Crypto: How to generate subjectKeyIdentifier / authorityKeyIdentifier

2009-08-05 Thread Matthias Güntert
> M2Crypto has a couple of bugs open related that, with potential > workarounds that I haven't yet deemed polished enough to checkin, but > which might help you out: > > https://bugzilla.osafoundation.org/show_bug.cgi?id=7530 > https://bugzilla.osafoundation.org/show_bug.cgi?id=12151 Thanks, that

Re: Web page data and urllib2.urlopen

2009-08-05 Thread Dave Angel
Massi wrote: Hi everyone, I'm using the urllib2 library to get the html source code of web pages. In general it works great, but I'm having to do with a financial web site which does not provide the souce code I expect. As a matter of fact if you try: import urllib2 res = urllib2.urlopen("http:/

Re: Two Dimensional Array + ctypes

2009-08-05 Thread Gabriel Genellina
En Wed, 05 Aug 2009 20:12:09 -0300, Sparky escribió: Hello! I am trying to call this method: long _stdcall AIBurst(long *idnum, [...] long timeout, float (*voltages)[4], long *stateIOout, long *

Re: Error on Attaching to the process while debugging

2009-08-05 Thread Dave Angel
MalC0de wrote: Hello there, I'm writting a debugger, the problem is there no good interpretation ... here's the codes: my_debugger.py : #!/usr/bin/env python from ctypes import * from my_debugger_defines import * kernel32 = windll.kernel32 class debugger(): def __init__(self): s

Re: Python docs disappointing - group effort to hire writers?

2009-08-05 Thread RayS
At 08:35 PM 8/5/2009 -0700, r wrote: """... Any real sense of community is undermined -- or even destroyed -- to be replaced by virtual equivalents that strive, unsuccessfully, to synthesize a sense of community.""" I've brought up the idea of the quasi-community doc that PHP uses to good effect

Re: Using Python to automate builds

2009-08-05 Thread Tim Arnold
"Kosta" wrote in message news:84d9ae10-3aee-40a8-97ac-05799da0d...@f18g2000prf.googlegroups.com... >I am a Python newbie, tasked with automating (researching) building > Windows drivers using the WDK build environment. I've been looking > into Python for this (instead of writing a bunch of batc

oNVDL validation docbook 5

2009-08-05 Thread Tim Arnold
Hi, I'm using the oNVDL java validator for my DocBook 5.0 documents. Otherwise, my doc system is python. I wonder if there is any work going on (or perhaps something I'm missing) to use python to validate DocBook 5 (using the rng files bundled with the DocBook5 distribution) I think the catch w

Re: Python docs disappointing - group effort to hire writers?

2009-08-05 Thread r
On Aug 4, 12:55 am, David Lyon wrote: > It isn't totally about the writers... > Peoples egos are also at stake - it seems. > If "Fred X wrote Doc Y".. they don't want their name taken off.. So > they generally speaking don't want the docs changed. > If you talk too much about docs.. you can be tol

Re: Subclassing Python's dict

2009-08-05 Thread alex23
Xavier Ho wrote: > You should subclass collections.UserDict, and not the default dict class. > Refer to the collections module. Xavier, why do you think that is the correct approach? The docs say "The need for this class has been largely supplanted by the ability to subclass directly from dict (a

os.system in a service

2009-08-05 Thread Lawrence Wong
Hi, I wrote a program which runs a .bat file using os.system like: 'os.system(pathToBatFile)' and everything was good. Then I decided to turn my program into a service as opposed to being run with the command prompt showing. When my program became a service, I noticed that the os.system comm

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-05 Thread Paul Rubin
"Martin P. Hellwig" writes: > Is there an advantage using shifts and masks over my kitchen type solution? Weren't you complaining about the 8-to-1 expansion from turning each bit to an ascii char? -- http://mail.python.org/mailman/listinfo/python-list

Re: merge two png pic

2009-08-05 Thread cocobear
On Aug 5, 3:44 pm, News123 wrote: > You didn't really tell us why you need one big file, which contains more > pixel, than you can probably store in RAM > In fact I do not need such a big image. I just want to know the solution. > Is it for printing? > Not knwoing your goal makes it difficult t

access read / write violation with ctypes

2009-08-05 Thread DH
Hi all, I'm quite new to cytpes and am having some troubles I was hoping I could get a little help with. Before I get into the details this is what I'm trying to accomplish - I would like to read a dng with python pass it through either libraw.dll or dcraw.dll (notes on dcraw.dll version at the en

Re: Turtle Graphics are incompatible with gmpy

2009-08-05 Thread Mensanator
On Aug 5, 7:49 pm, Gregor Lingl wrote: > Mensanator schrieb: > > > On Aug 5, 5:31 pm, Mensanator wrote: > >> I fixed this to produce the actual image I'm looking > >> for instead of that stupid black square. All I did was > >> use up() & dowm() in place of penup(), pendown() and > >> replace dot(

Re: unicode() vs. s.decode()

2009-08-05 Thread John Machin
Jason Tackaberry urandom.ca> writes: > On Wed, 2009-08-05 at 16:43 +0200, Michael Ströder wrote: > > These both expressions are equivalent but which is faster or should be used > > for any reason? > > u = unicode(s,'utf-8') > > u = s.decode('utf-8') # looks nicer > > It is sometimes non-obvious w

Re: Turtle Graphics are incompatible with gmpy

2009-08-05 Thread Gregor Lingl
Mensanator schrieb: On Aug 5, 5:31 pm, Mensanator wrote: I fixed this to produce the actual image I'm looking for instead of that stupid black square. All I did was use up() & dowm() in place of penup(), pendown() and replace dot(2) with forward(1). I'll be posting a followup report later.

Re: Datetime with float seconds

2009-08-05 Thread Gabriel Genellina
En Wed, 05 Aug 2009 09:50:04 -0300, kpal escribió: The standard datetime has 1 microsecond granularity. Note that this is the finest granularity a datetime object can store, NOT the precision of datetime.now() by example. My application needs finer time resolution, preferably float seconds.

sqlite3 gui

2009-08-05 Thread NighterNet
This took a while to get a gui working. I am new at this coding. This work with sqlite3 Python Version: 3.1.0. The older version doesn't work. #!/usr/local/bin/python ''' This is for basic database access to view the information. Python version: 3.1.0 Features: -view database. -run script -u

Re: Install setup tools for 2.6

2009-08-05 Thread Gabriel Genellina
En Wed, 05 Aug 2009 15:31:38 -0300, Jeremy Cowles escribió: Ok, I feel like this is a really stupid question, but how do you install setup tools for Python 2.6 under windows? The only format is .egg which requires setup tools to install, doesn't it? I have no idea, and I try to stay as far

Re: using expy to extend python

2009-08-05 Thread Yingjie Lan
> From: Wolfgang Rohdewald > Subject: Re: using expy to extend python > To: python-list@python.org > Date: Thursday, August 6, 2009, 3:48 AM > On Thursday 06 August 2009, Yingjie > Lan wrote: > > For more information about expy, please visit its > homepage at: > > http://expy.sf.net/ > > looks v

Re: remove last 76 letters from string

2009-08-05 Thread MRAB
PeroMHC wrote: Hi All, So here is the problem... I have a FASTA file (used for DNA analyses) that looks like this: ... gnl|SRA|SRR019045.10.1 SL-XAY_956090708:2:1:0:1028.1 length=152 NCTTTATTGTATAAATGAAGTTTCACTATATCGGACGAGCGGTTCAGCAGTCATTCCGAGAC CGATATAGTGAAACTTCATTTCTACANTACCAAACG

Re: String to valid Python identifier

2009-08-05 Thread MRAB
Дамјан Георгиевски wrote: Is there any easy function in the stdlib to convert any random string in a valid Python identifier .. possibly by replacing non-valid characters with _ ? Python 2.x only, so no need to do Unicode. Lookup the 'maketrans' function in the 'string' module and the 'trans

Re: remove last 76 letters from string [sorry, errata]

2009-08-05 Thread Jan Kaliszewski
Dnia 06-08-2009 o 01:54:46 PeroMHC wrote: This snippet represents 3 individual DNA sequences. Each sequences is identified by the line starting with > The complete file has about 10 million individual sequences. A simple enough problem, I want to read in this data, and cut out the last 76 lett

Re: remove last 76 letters from string

2009-08-05 Thread Jan Kaliszewski
Dnia 06-08-2009 o 01:54:46 PeroMHC wrote: This snippet represents 3 individual DNA sequences. Each sequences is identified by the line starting with > The complete file has about 10 million individual sequences. A simple enough problem, I want to read in this data, and cut out the last 76 lett

String to valid Python identifier

2009-08-05 Thread Дамјан Георгиевски
Is there any easy function in the stdlib to convert any random string in a valid Python identifier .. possibly by replacing non-valid characters with _ ? Python 2.x only, so no need to do Unicode. -- дамјан ( http://softver.org.mk/damjan/ ) Religion ends and philosophy begins, just as alche

Re: using expy to extend python

2009-08-05 Thread Wolfgang Rohdewald
On Thursday 06 August 2009, Yingjie Lan wrote: > For more information about expy, please visit its homepage at: > http://expy.sf.net/ looks very interesting, bookmarked. In your example class mate, def rename looks wrong: if malloc fails, the previous name should probably not be replaced by an em

remove last 76 letters from string

2009-08-05 Thread PeroMHC
Hi All, So here is the problem... I have a FASTA file (used for DNA analyses) that looks like this: ... >gnl|SRA|SRR019045.10.1 SL-XAY_956090708:2:1:0:1028.1 length=152 NCTTTATTGTATAAATGAAGTTTCACTATATCGGACGAGCGGTTCAGCAGTCATTCCGAGAC CGATATAGTGAAACTTCATTTCTACANTACCAAACGTCGCTCGGCAGAGCGTCG

Programming by Contract

2009-08-05 Thread Ethan Furman
Greetings! I have seen posts about the assert statement and PbC (or maybe it was DbC), and I just took a very brief look at pycontract (http://www.wayforward.net/pycontract/) and now I have at least one question: Is this basically another way of thinking about unit testing, or is the idea of

Re: Turtle Graphics are incompatible with gmpy

2009-08-05 Thread Mensanator
On Aug 5, 5:31 pm, Mensanator wrote: > I fixed this to produce the actual image I'm looking > for instead of that stupid black square. All I did was > use up() & dowm() in place of penup(), pendown() and > replace dot(2) with forward(1). > > I'll be posting a followup report later. > http://www.m

Two Dimensional Array + ctypes

2009-08-05 Thread Sparky
Hello! I am trying to call this method: long _stdcall AIBurst(long *idnum, long demo, long stateIOin, long updateIO, long ledOn, long numChannels, l

Re: Install setup tools for 2.6

2009-08-05 Thread Ned Deily
In article <373cf0740908051131gacaf77apba48fa40e929f...@mail.gmail.com>, Jeremy Cowles wrote: > Ok, I feel like this is a really stupid question, but how do you install > setup tools for Python 2.6 under windows? > The only format is .egg which requires setup tools to install, doesn't it? http:

using expy to extend python

2009-08-05 Thread Yingjie Lan
Hi, The expy project provides an express way to extend Python. After some careful considerations, I came up with some reasons for expy (this is not an exhaustive list): (I). WYSIWYG. The expy project enables you to write your module in Python the way your extension would be (WYSIWYG), and mea

Re: trouble with complex numbers

2009-08-05 Thread Steven D'Aprano
On Wed, 05 Aug 2009 15:27:51 -0500, Robert Kern wrote: > On 2009-08-05 15:16, Dr. Phillip M. Feldman wrote: >> I am using Python 2.5, and most of the cmath functions are not yet >> available in this version. Thanks! >> >> Phillip >> >> P.S. In your code, that should be x+= 0J >> >> P.P.S. I wish

ANN: extprot 0.1.1

2009-08-05 Thread Ryan Kelly
Hi All, Sorry if you get this twice, it seems to have gotten lost on its way through python-announce. I'm pleased to announce the first release of the "extprot" python module. Extprot implements a compact, efficient, extensible and language-neutral object serialisation protocol. License:

Re: Turtle Graphics are incompatible with gmpy

2009-08-05 Thread Mensanator
I fixed this to produce the actual image I'm looking for instead of that stupid black square. All I did was use up() & dowm() in place of penup(), pendown() and replace dot(2) with forward(1). I'll be posting a followup report later. import gmpy ## (even) hi| ##| ##

Re: How to combine regexps?

2009-08-05 Thread MRAB
kj wrote: In kj writes: One of the nice things one can do with Perl's regexp's is illustrated in the following example: my $gly = qr/gg[ucag]/i my $ala = qr/gc[ucag]/i; my $val = qr/gu[ucag]/i; my $leu = qr/uu[ag]|cu[ucag]/i; my $ile = qr/au[uca]/i; my $aliphatic = qr/$gly|$ala|$val|$

Re: Google sitemap generator in python gone?

2009-08-05 Thread Martin P. Hellwig
Jon Clements wrote: Now please piddle off... I am guessing west-midlands? :-) -- MPH http://blog.dcuktec.com 'If consumed, best digested with added seasoning to own preference.' -- http://mail.python.org/mailman/listinfo/python-list

Re: Google sitemap generator in python gone?

2009-08-05 Thread Jon Clements
On 5 Aug, 22:44, Xah Lee wrote: > google used to have a sitemap generator written in python, at: >  https://www.google.com/webmasters/tools/docs/en/sitemap-generator.html > > but the url is gone. It seems the current version is moved > here:http://code.google.com/p/googlesitemapgenerator/ > and i

Re: access string data from within cython

2009-08-05 Thread sturlamolden
On 5 Aug, 23:22, "Diez B. Roggisch" wrote: > And that gives me the *full* bytestring, not only until the first zero? > I can't try that right now (not at work anymore), but if it's that easy, > that would be great. It should, and if it does not it is a bug in Cython. The len() function should wo

Google sitemap generator in python gone?

2009-08-05 Thread Xah Lee
google used to have a sitemap generator written in python, at: https://www.google.com/webmasters/tools/docs/en/sitemap-generator.html but the url is gone. It seems the current version is moved here: http://code.google.com/p/googlesitemapgenerator/ and is written in JavaScript. is the old python

Re: access string data from within cython

2009-08-05 Thread Philip Semanchuk
On Aug 5, 2009, at 5:19 PM, Diez B. Roggisch wrote: Philip Semanchuk schrieb: On Aug 5, 2009, at 1:16 PM, Diez B. Roggisch wrote: Hi, I'm trying to wrap a C-API which has a call that takes a void* and a size_t as arguments. void foo(void *data, size_t length) The wrapper is supposed to

Re: access string data from within cython

2009-08-05 Thread Diez B. Roggisch
sturlamolden schrieb: On 5 Aug, 19:16, "Diez B. Roggisch" wrote: void foo(void *data, size_t length) The wrapper is supposed to be called with a python (byte)string instance, which might contain more than one '\0'-character. So how do I access the raw data of a string? cdef extern void foo

Re: Subclassing Python's dict

2009-08-05 Thread Xavier Ho
On Thu, Aug 6, 2009 at 5:23 AM, Joshua Kugler wrote: > Are you referring to Python 3.0? Python 2.6 does not have > collections.UserDict > > j > Yes, I was sometimes it's hard to keep track what's not in 2.6 and in 3.1 for me, sorry. And thanks. The ABC MutableMapping is still valid, though.

Re: access string data from within cython

2009-08-05 Thread Diez B. Roggisch
Philip Semanchuk schrieb: On Aug 5, 2009, at 1:16 PM, Diez B. Roggisch wrote: Hi, I'm trying to wrap a C-API which has a call that takes a void* and a size_t as arguments. void foo(void *data, size_t length) The wrapper is supposed to be called with a python (byte)string instance, which

Re: Turtle Graphics are incompatible with gmpy

2009-08-05 Thread Mensanator
On Aug 5, 12:56 pm, Gregor Lingl wrote: > Mensanator schrieb: > > > > > > >> It didn't form 2.5 to 2.6 (at least not intentionally). But with the > >> indroduction of the TurtleScreen class and the Screen class/object > >> (singleton) a few of the turtle methods were also implemented as screen > >

Re: Is this a bug in multiprocessing or in my script?

2009-08-05 Thread Jesse Noller
On Aug 5, 4:41 pm, sturlamolden wrote: > On 5 Aug, 22:28, Jesse Noller wrote: > > >http://bugs.python.org/issue6653 > > > In the future please use the bug tracker to file and track bugs with, > > so things are not as lossy. > > Ok, sorry :) > > Also see Piet's comment here. He has a valid case ag

Re: Do anyone here use Python *embedded* in a database?

2009-08-05 Thread Roger Binns
Jonathan Fine wrote: > anyone here ever used the Python *embedded* in a database server. There is also the case of using SQLite where it shares the same process as your Python code (and nothing else) and is a standard part of the Python library. You can add your own functions and collations and i

[ATTN] Sr. Software Development Engineer

2009-08-05 Thread WordStream
Postion Title - Sr. Software Development Engineer Job Responsibilities The Sr. Software Development Engineer will be responsible for the design, development and implementation of the award-winning WordStream suite of products. Development is presently done primarily using Python on the server and

Re: Is this a bug in multiprocessing or in my script?

2009-08-05 Thread sturlamolden
On 5 Aug, 22:28, Jesse Noller wrote: > http://bugs.python.org/issue6653 > > In the future please use the bug tracker to file and track bugs with, > so things are not as lossy. Ok, sorry :) Also see Piet's comment here. He has a valid case against sys.exit in some cases. Thus it appears that bot

Re: Turtle Graphics are incompatible with gmpy

2009-08-05 Thread Mensanator
On Aug 5, 3:08 pm, Ethan Furman wrote: > Mensanator wrote: > > > > > > > > > > > What does this mean? > > import turtle > tooter = turtle.Turtle() > *tooter*.tracer > > > Traceback (most recent call last): > >   File "", line 1, in > >     tooter.tracer > > AttributeError: 'Turtle' o

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-05 Thread Jon Clements
On 5 Aug, 20:41, "Martin P. Hellwig" wrote: > Paul Rubin wrote: > > "Martin P. Hellwig" writes: > >> Is there an advantage using shifts and masks over my kitchen type solution? > > > Weren't you complaining about the 8-to-1 expansion from turning each bit > > to an ascii char? > > Yes you are (of

Re: How to combine regexps?

2009-08-05 Thread kj
In kj writes: >One of the nice things one can do with Perl's regexp's is illustrated >in the following example: >my $gly = qr/gg[ucag]/i >my $ala = qr/gc[ucag]/i; >my $val = qr/gu[ucag]/i; >my $leu = qr/uu[ag]|cu[ucag]/i; >my $ile = qr/au[uca]/i; >my $aliphatic = qr/$gly|$ala|$val|$leu|$ile/

Re: How to combine regexps?

2009-08-05 Thread Carl Banks
On Aug 5, 1:09 pm, kj wrote: > One of the nice things one can do with Perl's regexp's is illustrated > in the following example: > > my $gly = qr/gg[ucag]/i > my $ala = qr/gc[ucag]/i; > my $val = qr/gu[ucag]/i; > my $leu = qr/uu[ag]|cu[ucag]/i; > my $ile = qr/au[uca]/i; > > my $aliphatic = qr/$gly

Re: Is this a bug in multiprocessing or in my script?

2009-08-05 Thread sturlamolden
On 5 Aug, 22:07, Piet van Oostrum wrote: > Calling os.exit in a child process may be dangerous. It can cause > unflushed buffers to be flushed twice: once in the parent and once in > the child. I assume you mean sys.exit. If this is the case, multiprocessing needs a mechanism to chose between os

Web page data and urllib2.urlopen

2009-08-05 Thread Massi
Hi everyone, I'm using the urllib2 library to get the html source code of web pages. In general it works great, but I'm having to do with a financial web site which does not provide the souce code I expect. As a matter of fact if you try: import urllib2 res = urllib2.urlopen("http://www.marketwatc

Re: Is this a bug in multiprocessing or in my script?

2009-08-05 Thread Jesse Noller
On Aug 5, 3:40 pm, sturlamolden wrote: > On 5 Aug, 21:36, sturlamolden wrote: > > >http://svn.python.org/view/python/branches/release26-maint/Lib/multip... > > >http://svn.python.org/view/python/branches/release31-maint/Lib/multip... > > http://svn.python.org/view/python/trunk/Lib/multiprocessing

Error on Attaching to the process while debugging

2009-08-05 Thread MalC0de
Hello there, I'm writting a debugger, the problem is there no good interpretation ... here's the codes: my_debugger.py : #!/usr/bin/env python from ctypes import * from my_debugger_defines import * kernel32 = windll.kernel32 class debugger(): def __init__(self): self.h_process = No

Re: trouble with complex numbers

2009-08-05 Thread Robert Kern
On 2009-08-05 15:16, Dr. Phillip M. Feldman wrote: I am using Python 2.5, and most of the cmath functions are not yet available in this version. Thanks! Phillip P.S. In your code, that should be x+= 0J P.P.S. I wish that the documentation indicated anything that is new. It does. http://doc

Re: Python configuration question when python scripts are executed using Appweb as web server.

2009-08-05 Thread Gabriel Genellina
En Tue, 04 Aug 2009 10:15:24 -0300, IronyOfLife escribió: On Aug 3, 8:42 pm, "Gabriel Genellina" wrote: En Mon, 03 Aug 2009 11:04:07 -0300, IronyOfLife escribió: > I have installed python 2.6.2 in windows xp professional machine. I > have set the following environment variables -- PYTHONPA

Re: trouble with complex numbers

2009-08-05 Thread Dr. Phillip M. Feldman
I am using Python 2.5, and most of the cmath functions are not yet available in this version. Thanks! Phillip P.S. In your code, that should be x+= 0J P.P.S. I wish that the documentation indicated anything that is new. Christian Heimes-2 wrote: > > > > phase() has been added to Python 2.

Re: http access produces 503

2009-08-05 Thread Piet van Oostrum
> Rog (R) wrote: >R> I am porting a simple code from Perl, the website asks for usr/pwd and >R> the server's side Perl script makes atemp ftp dir for file upload. >R> The original Perl script connects okay, does its job. The same URL >R> stuffed into FF3 performs the same way. >R> My Python

Re: Printing with colors in a portable way

2009-08-05 Thread Aahz
In article <19e16923-b200-498b-9ab2-f7d316b56...@d32g2000yqh.googlegroups.com>, r wrote: >On Aug 2, 9:52=A0pm, a...@pythoncraft.com (Aahz) wrote: > >> Much as I hate to say, use a cross-platform GUI -- Tkinter comes with >> Python, > >Why is Tkinter such a whipping boy of the Python community?

Re: Turtle Graphics are incompatible with gmpy

2009-08-05 Thread Ethan Furman
Mensanator wrote: What does this mean? import turtle tooter = turtle.Turtle() *tooter*.tracer Traceback (most recent call last): File "", line 1, in tooter.tracer AttributeError: 'Turtle' object has no attribute 'tracer' tooter.hideturtle() tooter.speed('fast') turtle.update() *

How to combine regexps?

2009-08-05 Thread kj
One of the nice things one can do with Perl's regexp's is illustrated in the following example: my $gly = qr/gg[ucag]/i my $ala = qr/gc[ucag]/i; my $val = qr/gu[ucag]/i; my $leu = qr/uu[ag]|cu[ucag]/i; my $ile = qr/au[uca]/i; my $aliphatic = qr/$gly|$ala|$val|$leu|$ile/; In other words, one c

Re: Is this a bug in multiprocessing or in my script?

2009-08-05 Thread Piet van Oostrum
> sturlamolden (s) wrote: >s> On 5 Aug, 15:40, Jesse Noller wrote: >>> Sturla; >>> >>> That bug was fixed unless I'm missing something. >s> It is still in SVN. Change every call to os._exit to sys.exit >s> please. :) Calling os.exit in a child process may be dangerous. It can cause unflus

Re: Turtle Graphics are incompatible with gmpy

2009-08-05 Thread Wolfram Hinderer
On 5 Aug., 21:31, Mensanator wrote: > > >>> import turtle > >>> tooter = turtle.Turtle() > >>> tooter.tracer > > Traceback (most recent call last): >   File "", line 1, in >     tooter.tracer > AttributeError: 'Turtle' object has no attribute 'tracer'>>> > tooter.hideturtle() > >>> tooter.speed(

Re: no-clobber dicts?

2009-08-05 Thread kj
In <00027aa9$0$2969$c3e8...@news.astraweb.com> Steven D'Aprano writes: >No problem. Here you go: >http://www.cybersource.com.au/users/steve/python/constants.py Extremely helpful. Thanks! kynn -- http://mail.python.org/mailman/listinfo/python-list

Re: Is this a bug in multiprocessing or in my script?

2009-08-05 Thread ryles
On Aug 4, 10:37 pm, erikcw wrote: > Traceback (most recent call last): >   File "scraper.py", line 144, in >     print pool.map(scrape, range(10)) >   File "/usr/lib/python2.6/multiprocessing/pool.py", line 148, in map >     return self.map_async(func, iterable, chunksize).get() >   File "/usr/li

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-05 Thread Martin P. Hellwig
Paul Rubin wrote: "Martin P. Hellwig" writes: Is there an advantage using shifts and masks over my kitchen type solution? Weren't you complaining about the 8-to-1 expansion from turning each bit to an ascii char? Yes you are (of course) right, my 'dream' solution would be something that ac

Re: Is this a bug in multiprocessing or in my script?

2009-08-05 Thread sturlamolden
On 5 Aug, 21:36, sturlamolden wrote: > http://svn.python.org/view/python/branches/release26-maint/Lib/multip... > > http://svn.python.org/view/python/branches/release31-maint/Lib/multip... http://svn.python.org/view/python/trunk/Lib/multiprocessing/forking.py?revision=65864&view=markup -- http

Re: Is this a bug in multiprocessing or in my script?

2009-08-05 Thread sturlamolden
On 5 Aug, 15:40, Jesse Noller wrote: > Sturla; > > That bug was fixed unless I'm missing something. It is still in SVN. Change every call to os._exit to sys.exit please. :) http://svn.python.org/view/python/branches/release26-maint/Lib/multiprocessing/forking.py?revision=66717&view=markup http

Re: Turtle Graphics are incompatible with gmpy

2009-08-05 Thread Mensanator
On Aug 5, 2:19 am, Steven D'Aprano wrote: > On Wed, 5 Aug 2009 03:49 pm Mensanator wrote: > > > In 3.1, tracing is now a screen attribute, not a turtle atribute. > > I have no idea why > > >   tooter = turtle.Turtle() > >   tooter.tracer(False) > > > doesn't give me an error (I thought silent erro

Re: Do anyone here use Python *embedded* in a database?

2009-08-05 Thread Joshua Kugler
Jonathan Fine wrote: > Hi > > I'm writing a talk that compares embed and extend, and wondered if > anyone here ever used the Python *embedded* in a database server. > http://twistedmatrix.com/users/glyph/rant/extendit.html > > Web frameworks (such as Django) use extend, to import an extensi

Re: access string data from within cython

2009-08-05 Thread sturlamolden
On 5 Aug, 21:23, sturlamolden wrote: > foo(data, length) Oops, that would be foo( data, length) -- http://mail.python.org/mailman/listinfo/python-list

Re: access string data from within cython

2009-08-05 Thread sturlamolden
On 5 Aug, 19:16, "Diez B. Roggisch" wrote: > void foo(void *data, size_t length) > > The wrapper is supposed to be called with a python (byte)string instance, > which might contain more than one '\0'-character. > > So how do I access the raw data of a string? cdef extern void foo(void *data, int

Re: Subclassing Python's dict

2009-08-05 Thread Joshua Kugler
Xavier Ho wrote: > On Thu, Aug 6, 2009 at 11:51 AM, Sergey Simonenko > wrote: > >> I subclass builtin 'dict' in my application and experience some problems >> with it. >> > > You should subclass collections.UserDict, and not the default dict class. > Refer to the collections module. Are you ref

Re: trouble with complex numbers

2009-08-05 Thread pdlemper
On Wed, 05 Aug 2009 08:18:55 -0700, Scott David Daniels wrote: >I think it explained in the complex math area, but basically EE types >use j, math types use i for exactly the same thing. Since i is so >frequently and index in CS, and there is another strong convention, >why not let the EE types

Re: Confessions of a Python fanboy

2009-08-05 Thread Just Another Victim of the Ambient Morality
"Steven D'Aprano" wrote in message news:pan.2009.08.04.09.28...@remove.this.cybersource.com.au... > On Tue, 04 Aug 2009 10:03:53 +0200, Bruno Desthuilliers wrote: > >>> Disadvantages: your code is filled with line noise. It's an arbitrary >>> choice between @@ meaning instance attribute and @@ m

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-05 Thread Martin P. Hellwig
Paul Rubin wrote: "Martin P. Hellwig" writes: what I usually do is read the packet in binary mode, convert the output to a concatenated 'binary string'(i.e. '0101011000110') and Something wrong with reading the data words as an integer and using old fashioned shifts and masks to get at the bi

Install setup tools for 2.6

2009-08-05 Thread Jeremy Cowles
Ok, I feel like this is a really stupid question, but how do you install setup tools for Python 2.6 under windows? The only format is .egg which requires setup tools to install, doesn't it? Thanks, Jeremy -- http://mail.python.org/mailman/listinfo/python-list

Re: access string data from within cython

2009-08-05 Thread Philip Semanchuk
On Aug 5, 2009, at 1:16 PM, Diez B. Roggisch wrote: Hi, I'm trying to wrap a C-API which has a call that takes a void* and a size_t as arguments. void foo(void *data, size_t length) The wrapper is supposed to be called with a python (byte)string instance, which might contain more than

Re: Is it possible to produce spider plots?

2009-08-05 Thread Devon_Dan
> reportlab has a spider chart in reportlab/graphics/charts/spider.py > How about > http://matplotlib.sourceforge.net/examples/api/radar_chart.html?highl... Both exactly what I was after. Thanks very much. > The 'wxPython in Action' book has some simple example code which > produces this sort o

Re: Special chars with HTMLParser

2009-08-05 Thread Piet van Oostrum
> Fafounet (F) wrote: >F> Thank you, now I can get the correct character. >F> Now when I have the string abécd I can get ab then é thanks to >F> your function and then cd. But how is it possible to know that cd is >F> still the same word ? That depends on your definition of `word'. And that

Re: unicode() vs. s.decode()

2009-08-05 Thread 1x7y2z9
unicode() has LOAD_GLOBAL which s.decode() does not. Is it generally the case that LOAD_ATTR is slower than LOAD_GLOBAL that lead to your intuition that the former would probably be slower? Or some other intuition? Of course, the results from timeit are a different thing - I ask about the intuiti

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-05 Thread Paul Rubin
"Martin P. Hellwig" writes: > what I usually do is read the packet in binary mode, convert the > output to a concatenated 'binary string'(i.e. '0101011000110') and Something wrong with reading the data words as an integer and using old fashioned shifts and masks to get at the bit fields? -- http

Re: Turtle Graphics are incompatible with gmpy

2009-08-05 Thread Gregor Lingl
Mensanator schrieb: It didn't form 2.5 to 2.6 (at least not intentionally). But with the indroduction of the TurtleScreen class and the Screen class/object (singleton) a few of the turtle methods were also implemented as screen methods and as turtle methods declared deprecated (see docs of Python

Re: Turtle Graphics are incompatible with gmpy

2009-08-05 Thread Mensanator
> It didn't form 2.5 to 2.6 (at least not intentionally). But with the > indroduction of the TurtleScreen class and the Screen class/object > (singleton) a few of the turtle methods were also implemented as screen > methods and as turtle methods declared deprecated (see docs of Python > 2.6). These

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-05 Thread Masklinn
On 5 Aug 2009, at 19:17 , Bearophile wrote: Have you tried Hachoir? (I think its name may be changed to Fusil, I don't know). Name hasn't been changed (I think fusil is a subproject, something like that) on the other hand the hachoir.org site is dead. But apparently Hachoir was moved to bitbu

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-05 Thread Masklinn
On 5 Aug 2009, at 16:46 , Martin P. Hellwig wrote: Hi List, On several occasions I have needed (and build) a parser that reads a binary piece of data with custom structure. For example (bogus one): BE +-+-+-+-+--++ | Version | Command | Ins

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-05 Thread Bearophile
Martin P. Hellwig: > On several occasions I have needed (and build) a parser that reads a > binary piece of data with custom structure. For example (bogus one): > > BE > +-+-+-+-+--++ > | Version | Command | Instruction | Data Length | Data | Fill

access string data from within cython

2009-08-05 Thread Diez B. Roggisch
Hi, I'm trying to wrap a C-API which has a call that takes a void* and a size_t as arguments. void foo(void *data, size_t length) The wrapper is supposed to be called with a python (byte)string instance, which might contain more than one '\0'-character. So how do I access the raw data of a str

Re: Parsing Binary Structures; Is there a better way / What is your way?

2009-08-05 Thread Martin P. Hellwig
Jon Clements wrote: IIRC (and I have my doubts) the BitVector module may be of use, but it's been about 3 years since I had to look at it. I think it used the C equiv. of short ints to do its work. Otherwise, maybe the array module, the struct module or even possibly ctypes. Not much use, but m

Re: Is it possible to produce spider plots?

2009-08-05 Thread Mark Lawrence
dp_pearce wrote: I want to be able to use Python to produce Spider plots (perhaps you know them as radar plots or star plots). Does anyone know how to achieve this? Are there existing libraries? Direction to any examples, especially those with tutorials, would be greatly appreciated. Cheers, Da

Re: Cypress FX2 - py libusb code?

2009-08-05 Thread RayS
Reply to self: code attached. As Marco wrote: "To run the single C file USB bulk read program properly, you must provide a source of data to the CY7C68013 FIFO bus, like the Simple dual channel A/D system, otherwise the reading call will time out in one second, you will get a bunch of zeros, and

Re: Do anyone here use Python *embedded* in a database?

2009-08-05 Thread Jonathan Fine
Jon Clements wrote: On 5 Aug, 13:17, Jonathan Fine wrote: Hi I'm writing a talk that compares embed and extend, and wondered if anyone here ever used the Python *embedded* in a database server. http://twistedmatrix.com/users/glyph/rant/extendit.html Web frameworks (such as Django) use ex

  1   2   >