Re: porting C code

2005-01-13 Thread Roy Smith
Lucas Raab <[EMAIL PROTECTED]> wrote: > I am currently in the process of porting some C code into Python and am > stuck. I don't claim to be the greatest C/C++ programmer; in fact, my > skills at C are rudimentary at best. My question is I have the > statement: "typedef unsigned long int word

Re: porting C code

2005-01-13 Thread Peter Hansen
Lucas Raab wrote: I have the statement: "typedef unsigned long int word32" and later on: "word32 b[3]" referencing the third bit of the integer. If that's really exactly what you have, then you actually have something defining an array of three unsigned long integers named "b". And even if y

query python env

2005-01-13 Thread David Bear
How does one query the python environment, ie pythonhome, pythonpath, etc. also, are there any HOWTO's on keeping multiple versions of python happy? -- http://mail.python.org/mailman/listinfo/python-list

Re: how to stop google from messing Python code

2005-01-13 Thread Xah Lee
gmane is great! its renaming of newsgroups is quite a headache. i found that comp.lang.python corresponds to gmane.comp.python.general. do you know which one corresponds to comp.lang.perl.misc? there's no .misc or .general... -- i thought there a strick like preceding a line by -- or something tha

Re: porting C code

2005-01-13 Thread Peter Hansen
Peter Hansen wrote: but merely a "b[3]" reference somewhere, it would be referencing the third element of an array called "b", which is possibly a byte, "*Fourth* element... I'll come in again. Amongst our elements..." -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie: module structure and import question

2005-01-13 Thread Rob Emmons
> hi all, > i have question on how to design a module structure. > for example, i have 3 files. > [somewhere]/main.py > [somewhere]/myLib/Base/BaseA.py > [somewhere]/myLib/ClassA.py > > . > It's fine when i run main.py. > however when i run ClassA.py individually, it would fail in import >

Re: Gecko bindings for Python?

2005-01-13 Thread Cordula's Web
Yes, that's exactly what I needed! Thanks alot! -cpghost. -- Cordula's Web. http://www.cordula.ws/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Debian says "Warning! you are running an untested version of Python." on 2.3

2005-01-13 Thread rbt
Nick Craig-Wood wrote: > Alex Stapleton <[EMAIL PROTECTED]> wrote: >> Whenever I run python I get >> >> "Warning! you are running an untested version of Python." >> >> prepended to the start of any output on stdout. >> >> This is with Debian and python 2.3 (running the debian 2.1 and 2.2 >>

Re: Python.org, Website of Satan

2005-01-13 Thread Dan Bishop
DogWalker wrote: > "Luis M. Gonzalez" <[EMAIL PROTECTED]> said: > > >[EMAIL PROTECTED] wrote: > >> python.org = 194.109.137.226 > >> > >> 194 + 109 + 137 + 226 = 666 > >> > >> What is this website with such a demonic name and IP address? What > >> evils are the programmers who use this language up

Re: Unicode conversion in 'print'

2005-01-13 Thread Ricardo Bugalho
Hi, thanks for the information. But what I was really looking for was informaion on when and why Python started doing it (previously, it always used sys.getdefaultencoding())) and why it was done only for 'print' when stdout is a terminal instead of always. On Thu, 13 Jan 2005 14:33:20 -0800, Se

Re: newbie ?s

2005-01-13 Thread Larry Bates
You should probably take a look at: http://www.amk.ca/python/code/medusa Larry Bates Syscon, Inc. Venkat B wrote: Hi folks, I'm looking build a CGI-capable SSL-enabled web-server around Python 2.4 on Linux. It is to handle ~25 hits possibly arriving "at once". Content is non-static and built by th

a ConfigParser wtf moment

2005-01-13 Thread Eric S. Johansson
I'm not sure if this is a real problem or if I have been staring at code too long. given this code #!/usr/bin/python from ConfigParser import * configuration_file = "test.conf" substitution = {"xyzzy":"maze"} configuration = SafeConfigParser() configuration.readfp(file(configuration_file)) list

Re: Pyrex-0.9.3: definition mismatch with distutils of Python24

2005-01-13 Thread David M. Cooke
[EMAIL PROTECTED] (Martin Bless) writes: > Now that I've got my extension building machine using the VC++ Toolkit > 2003 up and running I'm keen on using Pyrex (Pyrex-0.9.3, > Python-2.4.0). > > But the definition of the swig_sources() method seems to have changed. > > When I try to build the exam

Re: a ConfigParser wtf moment

2005-01-13 Thread grahamd
Sort of hard to explain, but if you put another: list = configuration.items("core") print list at the end of the script, you will find that the original config hasn't been changed. It is a quirk of how the items() method is implemented using 'yield' that means that you see what you do. In partic

Re: a ConfigParser wtf moment

2005-01-13 Thread Eric S. Johansson
[EMAIL PROTECTED] wrote: To avoid this, you need to write something like: . list = [] . for key in configuration.options("core"): . list.append((key,configuration.get("core",substitution)) . print list This cause me problems for a different reason, ie., that user vars keys appear in what ite

file uploading via urllib2 (multipart/form-data)

2005-01-13 Thread Clark C. Evans
Hello. I was wondering if anyone has built a module that works with urllib2 to upload file content via POST multipart/form-data. I'm aware of ASPN 146306, however, I need to use urllib2 beacuse I'm using HTTP Digest over SSL. Cheers, Clark -- http://mail.python.org/mailman/listinfo/python-list

Class initialization from a dictionary, how best?

2005-01-13 Thread [EMAIL PROTECTED]
# # My problem is that I want to create a # class, but the variables aren't known # all at once. So, I use a dictionary to # store the values in temporarily. # Then when I have a complete set, I want to # init a class from that dictionary. # However, I don't want to specify the # dictionary gets by

Re: pyPgSQL giving error!

2005-01-13 Thread Gurpreet Sachdeva
> did you really do ./configure, make and make install? No, I did python setup.py build and python setup.py install > where is libpq.* linpq is there in /usr/lib/python2.3/site-packages/pyPgSQL/ > was a postgres installation present while doing ./configure et all? No, But I installed postgresql-

Re: pyPgSQL giving error!

2005-01-13 Thread Gurpreet Sachdeva
And now when I did... cd /usr/local/lib/python2.3/site-packages/pyPgSQL/libpq/ [EMAIL PROTECTED] libpq]# python __init__.py Traceback (most recent call last): File "__init__.py", line 23, in ? from libpq import * ImportError: ./libpqmodule.so: undefined symbol: PyUnicodeUCS2_EncodeDecimal

Re: a ConfigParser wtf moment

2005-01-13 Thread grahamd
True, wasn't thinking. This will affect get() as well. My problem was a slightly different problem. In your case you would have got what you wanted if get()/items() instead of being implemented as: .try: .value = d[option] .except KeyError: .raise NoOptionE

Interesting gDeskCal

2005-01-13 Thread none
I found that gDeskCal is also written in Python. So if I have a theme used by gDesklets, how can I make the whole thing standalone so that it can be similar to the case of gDeskCal?? -- http://mail.python.org/mailman/listinfo/python-list

import problems *newbie*

2005-01-13 Thread mike kreiner
I am having trouble importing a module I created. I'm running PythonWin on Windows XP if that helps. I saved my module in a folder called my_scripts in the site-packages directory. I edited the python path to include the my_scripts folder (it now reads C:\Python23\Lib;C:\Python23\DLLs;C:\Python23\L

Pickled text file causing ValueError (dos/unix issue)

2005-01-13 Thread Aki Niimura
Hello everyone, I started to use pickle to store the latest user settings for the tool I wrote. It writes out a pickled text file when it terminates and it restores the settings when it starts. It worked very nicely. However, I got a ValueError when I started the tool from Unix when I previously

Re: Pickled text file causing ValueError (dos/unix issue)

2005-01-13 Thread Paul Rubin
Open the file on windows for writing with "wb" mode, the b is for binary. -- http://mail.python.org/mailman/listinfo/python-list

Re: What strategy for random accession of records in massive FASTA file?

2005-01-13 Thread John Lenton
On Thu, Jan 13, 2005 at 12:19:49AM +0100, Fredrik Lundh wrote: > Chris Lasher wrote: > > > Since the file I'm working with contains tens of thousands of these > > records, I believe I need to find a way to hash this file such that I > > can retrieve the respective sequence more quickly than I coul

Re: reference or pointer to some object?

2005-01-13 Thread Torsten Mohr
Hi, thank you all for your explanations. That's really great and helps me a lot. Thanks, Torsten. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python.org, Website of Satan

2005-01-13 Thread Peter Renzland
In <[EMAIL PROTECTED]> On 2005-01-12 [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > python.org = 194.109.137.226 > > 194 + 109 + 137 + 226 = 666 > > What is this website with such a demonic name and IP address? What > evils are the programmers who use this language up to? What is the simplest/fa

Re: Octal notation: severe deprecation

2005-01-13 Thread Bengt Richter
On Thu, 13 Jan 2005 17:43:01 -0600, Jeff Epler <[EMAIL PROTECTED]> wrote: > >--LQksG6bCIzRHxTLp >Content-Type: text/plain; charset=us-ascii >Content-Disposition: inline >Content-Transfer-Encoding: quoted-printable > >On Thu, Jan 13, 2005 at 11:04:21PM +, Bengt Richter wrote: >> One way to do i

Re: Statement local namespaces summary (was Re: python3: 'where' keyword)

2005-01-13 Thread Nick Coghlan
Bengt Richter wrote: Problems? (Besides NIH, which I struggle with regularly, and had to overcome to accept Tim's starting point in this ;-) The ideas regarding creating blocks whose name bindings affect a different scope are certainly interesting (and relevant to the 'using' out-of-order executi

Re: Unclear On Class Variables

2005-01-13 Thread Pierre Barbier de Reuille
Antoon Pardon a écrit : Well I find this a confusing behaviour on python's part. The fact that instance.field can mean something different, depending on where in a statement you find it, makes the behaviour inconsistent. I know people in general here are against declarations, but declarations could

Re: python and macros (again) [Was: python3: 'where' keyword]

2005-01-13 Thread Nick Coghlan
Paul Rubin wrote: Come on, that is vacuous. The claim was "expressions are not statements". But it turns out that expressions ARE statements. The explanation is "well, that's because they're expression statements". And there is no obvious case of an expression that can't be used as a statement.

test

2005-01-13 Thread yuzx
test -- http://mail.python.org/mailman/listinfo/python-list

Re: python and macros (again) [Was: python3: 'where' keyword]

2005-01-13 Thread Paul Rubin
Nick Coghlan <[EMAIL PROTECTED]> writes: > So, precisely how should one go about cleanly embedding something that > cares about whitespace into a context which doesn't care in the > slightest? Treat the macro like a function call whose arguments are thunks made from the macro arguments, or somethi

Re: Class initialization from a dictionary, how best?

2005-01-13 Thread Nick Coghlan
[EMAIL PROTECTED] wrote: t2 = Test(dictionary.get('a'), dictionary.get('b'), dictionary.get('c')) print t2 Try this: t2 = Test(**dictionary) This performs keyword argument expansion on the dictionary, matching the dictionary entries with the named arguments to the Test.__init__ function. Cheers,

<    1   2   3