Re: shared library search path

2005-11-03 Thread Neal Becker
Stefan Arentz wrote: Hi. I've wrapped a C++ class with Boost.Python and that works great. But, I am now packaging my application so that it can be distributed. The structure is basically this: .../bin/foo.py .../lib/foo.so .../lib/bar.py In foo.py I do the following:

Re: efficient 'tail' implementation

2005-12-08 Thread Neal Becker
[EMAIL PROTECTED] wrote: hi I have a file which is very large eg over 200Mb , and i am going to use python to code a tail command to get the last few lines of the file. What is a good algorithm for this type of task in python for very big files? Initially, i thought of reading everything

Re: Spiritual Programming (OT, but Python-inspired)

2006-01-02 Thread Neal Becker
Steven D'Aprano wrote: On Mon, 02 Jan 2006 13:38:47 -0800, UrsusMaximus wrote: It seems to me that, if anything of a person survives death in any way, it must do so in some way very different from that way in which we exist now. [snip] I don't dare ask where your evidence for this

python optimization

2005-09-15 Thread Neal Becker
I use cpython. I'm accustomed (from c++/gcc) to a style of coding that is highly readable, making the assumption that the compiler will do good things to optimize the code despite the style in which it's written. For example, I assume constants are removed from loops. In general, an entity is

Re: python optimization

2005-09-15 Thread Neal Becker
Reinhold Birkenfeld wrote: David Wilson wrote: For the most part, CPython performs few optimisations by itself. You may be interested in psyco, which performs several heavy optimisations on running Python code. http://psyco.sf.net/ I might be, if it supported x86_64, but AFAICT, it

RE: [Python-Dev] python optimization

2005-09-16 Thread Neal Becker
One possible way to improve the situation is, that if we really believe python cannot easily support such optimizations because the code is too dynamic, is to allow manual annotation of functions. For example, gcc has allowed such annotations using __attribute__ for quite a while. This would

Re: Python:C++ interfacing. Tool selection recommendations

2005-09-16 Thread Neal Becker
[EMAIL PROTECTED] wrote: Hi, I am embedding Python with a C++ app and need to provide the Python world with access to objects data with the C++ world. I am aware or SWIG, BOOST, SIP. Are there more? I welcome comments of the pros/cons of each and recommendations on when it

Re: unusual exponential formatting puzzle

2005-09-21 Thread Neal Becker
[EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: Neal Becker wrote: Like a puzzle? I need to interface python output to some strange old program. It wants to see numbers formatted as: e.g.: 0.23456789E01 That is, the leading digit is always 0, instead of the first significant

Re: unusual exponential formatting puzzle

2005-09-22 Thread Neal Becker
Paul Rubin wrote: Neal Becker [EMAIL PROTECTED] writes: Like a puzzle? I need to interface python output to some strange old program. It wants to see numbers formatted as: e.g.: 0.23456789E01 Yeah, that was normal with FORTRAN. My solution is to print to a string with the '% 16.9E

@staticmethod, backward compatibility?

2005-09-27 Thread Neal Becker
How can I write code to take advantage of new decorator syntax, while allowing backward compatibility? I almost want a preprocessor. #if PYTHON_VERSION = 2.4 @staticmethod ... Since python 2.4 will just choke on @staticmethod, how can I do this? --

Compile fails on x86_64

2005-09-30 Thread Neal Becker
In file included from scipy/base/src/multiarraymodule.c:44: scipy/base/src/arrayobject.c: In function 'array_frominterface': scipy/base/src/arrayobject.c:5151: warning: passing argument 3 of 'PyArray_New' from incompatible pointer type error: Command gcc -pthread -fno-strict-aliasing -DNDEBUG -O2

compile fails on x86_64 (more)

2005-09-30 Thread Neal Becker
In file included from scipy/base/src/multiarraymodule.c:44: scipy/base/src/arrayobject.c:41: error: conflicting types for 'PyArray_PyIntAsIntp' build/src/scipy/base/__multiarray_api.h:147: error: previous declaration of 'PyArray_PyIntAsIntp' was here --

Can module access global from __main__?

2005-10-11 Thread Neal Becker
Suppose I have a main program, e.g., A.py. In A.py we have: X = 2 import B Now B is a module B.py. In B, how can we access the value of X? -- http://mail.python.org/mailman/listinfo/python-list

Re: Can module access global from __main__?

2005-10-11 Thread Neal Becker
Everything you said is absolutely correct. I was being lazy. I had a main program in module, and wanted to reorganize it, putting most of it into a new module. Being python, it actually only took a small effort to fix this properly, so that in B.py, what were global variables are now passed as

1-liner to iterate over infinite sequence of integers?

2005-10-13 Thread Neal Becker
I can do this with a generator: def integers(): x = 1 while (True): yield x x += 1 for i in integers(): Is there a more elegant/concise way? -- http://mail.python.org/mailman/listinfo/python-list

Re: Recommendations for CVS systems

2005-08-10 Thread Neal Becker
[EMAIL PROTECTED] wrote: I was wondering if anyone could make recomendations/comments about CVS systems, their experiences and what perhaps the strengths of each. Currently we have 2 developers but expect to grow to perhaps 5. Most of the developement is Python, but some C, Javascript,

Re: [ANN] functional 0.5 released

2006-02-11 Thread Neal Becker
I just installed from .tar.gz on fedora FC5 x86_64. I ran into 1 small problem: sudo python setup.py install --verbose running install running bdist_egg running egg_info writing functional.egg-info/PKG-INFO writing top-level names to functional.egg-info/top_level.txt reading manifest file

redirect stdout

2005-04-08 Thread Neal Becker
I'd like to build a module that would redirect stdout to send it to a logging module. I want to be able to use a python module that expects to print results using print or sys.stdout.write() and without modifying that module, be able to redirect it's stdout to a logger which will send the

index() of sequence type?

2008-02-07 Thread Neal Becker
I see list has index member, but is there an index function that applies to any sequence type? If not, shouldn't there be? -- http://mail.python.org/mailman/listinfo/python-list

Turn off ZeroDivisionError?

2008-02-09 Thread Neal Becker
I'd like to turn off ZeroDivisionError. I'd like 0./0. to just give NaN, and when output, just print 'NaN'. I notice fpconst has the required constants. I don't want to significantly slow floating point math, so I don't want to just trap the exception. If I use C code to turn off the hardware

Re: Turn off ZeroDivisionError?

2008-02-10 Thread Neal Becker
[EMAIL PROTECTED] wrote: Would a wrapper function be out of the question here? def MyDivision(num, denom): if denom==0: return NaN else return num / denom I bought a processor that has hardware to implement this. Why do I want software to waste time on it? --

Re: Turn off ZeroDivisionError?

2008-02-10 Thread Neal Becker
Christian Heimes wrote: Grant Edwards wrote: A more efficient implementation? Just delete the code that raises the exception and the HW will do the right thing. Do you really think that the hardware and the C runtime library will do the right thing? Python runs on a lots platforms and

Re: use 'with' to redirect stdout

2008-02-11 Thread Neal Becker
Jean-Paul Calderone wrote: On Mon, 11 Feb 2008 09:15:07 -0500, Neal Becker [EMAIL PROTECTED] wrote: Is there a simple way to use a 'with' statement to redirect stdout in a block? Do you mean without writing a context manager to do the redirection? I mean, whatever is the simplest solution

use 'with' to redirect stdout

2008-02-11 Thread Neal Becker
Is there a simple way to use a 'with' statement to redirect stdout in a block? -- http://mail.python.org/mailman/listinfo/python-list

Re: use 'with' to redirect stdout

2008-02-11 Thread Neal Becker
Thanks! I understand this better now. This is really an example of a more general pattern: @contextmanager def rebind_attr(object_, attr, value): orig = getattr(object_, attr) setattr(object_, attr, value) yield setattr(object_, attr_, orig) --

Re: Turn off ZeroDivisionError?

2008-02-11 Thread Neal Becker
Mark Dickinson wrote: On Feb 10, 3:10 pm, [EMAIL PROTECTED] wrote: What Python run on a CPU that doesn't handle the nan correctly? How about platforms that don't even have nans? I don't think either IBM's hexadecimal floating-point format, or the VAX floating-point formats support NaNs.

Re: use 'with' to redirect stdout

2008-02-11 Thread Neal Becker
This will work for stdout: from __future__ import with_statement from contextlib import contextmanager import sys @contextmanager def redirect(newfile): orig_stdout = sys.stdout sys.stdout = newfile yield sys.stdout = orig_stdout if __name__ == __main__: with redirect

Write ooxml .ods (spreadsheat) from python?

2008-02-13 Thread Neal Becker
I'd like to output some data directly in .ods format. This format appears to be quite complex. Is there any python software available to do this? I did look at pyuno briefly. It looks pretty complicated also, and it looks like it uses it's own private version of python, which would not help

Re: Write ooxml .ods (spreadsheat) from python?

2008-02-13 Thread Neal Becker
Rolf van de Krol wrote: Neal Becker wrote: I'd like to output some data directly in .ods format. This format appears to be quite complex. Is there any python software available to do this? I did look at pyuno briefly. It looks pretty complicated also, and it looks like it uses it's own

Re: Write ooxml .ods (spreadsheat) from python?

2008-02-13 Thread Neal Becker
Guilherme Polo wrote: 2008/2/13, Neal Becker [EMAIL PROTECTED]: I'd like to output some data directly in .ods format. Do you want to output data from .ods file or do you want to input data into an ods ? This format appears to be quite complex. Is there any python software available

Re: ODF vs OOXML (was: Write ooxml .ods (spreadsheat) from python?)

2008-02-13 Thread Neal Becker
Ben Finney wrote: Neal Becker [EMAIL PROTECTED] writes: I'd like to output some data directly in .ods format. Presumably you mean the OpenDocument Spreadsheet format. That's not OOXML, it's ODF, the international standard document format implemented in OpenOffice.org, KOffice, and many

can't set attributes of built-in/extension type

2008-02-21 Thread Neal Becker
I'm working on a simple extension. Following the classic 'noddy' example. In [15]: cmplx_int32 Out[15]: type 'numpy.cmplx_int32' Now I want to add an attribute to this type. More precisely, I want a class attribute. cmplx_int32.test = 0

Re: can't set attributes of built-in/extension type

2008-02-21 Thread Neal Becker
7stud wrote: On Feb 21, 11:19 am, Neal Becker [EMAIL PROTECTED] wrote: I'm working on a simple extension.  Following the classic 'noddy' example. In [15]: cmplx_int32 Out[15]: type 'numpy.cmplx_int32' Now I want to add an attribute to this type.  More precisely, I want a class attribute

Re: can't set attributes of built-in/extension type

2008-02-21 Thread Neal Becker
Steve Holden wrote: Neal Becker wrote: 7stud wrote: On Feb 21, 11:19 am, Neal Becker [EMAIL PROTECTED] wrote: I'm working on a simple extension. Following the classic 'noddy' example. In [15]: cmplx_int32 Out[15]: type 'numpy.cmplx_int32' Now I want to add an attribute to this type

Re: can't set attributes of built-in/extension type

2008-02-21 Thread Neal Becker
Steve Holden wrote: Neal Becker wrote: Steve Holden wrote: Neal Becker wrote: 7stud wrote: On Feb 21, 11:19 am, Neal Becker [EMAIL PROTECTED] wrote: I'm working on a simple extension. Following the classic 'noddy' example. In [15]: cmplx_int32 Out[15]: type 'numpy.cmplx_int32' Now

Re: How to factor using Python?

2008-03-11 Thread Neal Becker
Nathan Pinno wrote: How do I factor a number? I mean how do I translate x! into proper Python code, so that it will always do the correct math? Thanks in advance, Nathan P. import os os.system('factor 25') -- http://mail.python.org/mailman/listinfo/python-list

ioctl, pass buffer address, howto?

2008-04-25 Thread Neal Becker
I need an ioctl call equivalent to this C code: my_struct s; s.p = p; a pointer to an array of char s.image_size = image_size; return (ioctl(fd, xxx, s)); I'm thinking to use python array for the array of char, but I don't see how to put it's address into the structure. Maybe

problem with mmap

2008-04-25 Thread Neal Becker
On linux, I don't understand why: f = open ('/dev/eos', 'rw') m = mmap.mmap(f.fileno(), 100, prot=mmap.PROT_READ|mmap.PROT_WRITE, flags=mmap.MAP_SHARED) gives 'permission denied', but this c++ code works: #include sys/mman.h #include fcntl.h #include sys/types.h #include sys/stat.h #include

ioctl.py

2008-04-26 Thread Neal Becker
Gabriel Genellina wrote: En Fri, 25 Apr 2008 09:30:56 -0300, Neal Becker [EMAIL PROTECTED] escribió: I need an ioctl call equivalent to this C code: my_struct s; s.p = p; a pointer to an array of char s.image_size = image_size; return (ioctl(fd, xxx, s)); I'm thinking

send gpg encrypted emails (properly mime formatted)

2008-05-01 Thread Neal Becker
Any ideas on python packages that could help with sending gpg encrypted (properly mime formatted) emails? My idea is to forward all my emails to a remote imap server, but gpg encrypt them to myself in the process. -- http://mail.python.org/mailman/listinfo/python-list

looking for template package

2009-03-03 Thread Neal Becker
I'm looking for something to do template processing. That is, transform text making various substitutions. I'd like to be able to do substitutions that include python expressions, to do arithmetic computations within substitutions. I know there are lots of template packages, but most seem

This should be a simple question...

2009-03-06 Thread Neal Becker
Maybe I'm missing something obvious here def A (...): #set a bunch of variables x = 1 b = 2 ... Do something with them def B (...): #set the same bunch of variables x = 1 b = 2 ... Do something with them I want to apply DRY, and extract out the common setting of these

Re: This should be a simple question...

2009-03-06 Thread Neal Becker
Bruno Desthuilliers wrote: Neal Becker a écrit : Maybe I'm missing something obvious here def A (...): #set a bunch of variables x = 1 b = 2 ... Do something with them def B (...): #set the same bunch of variables x = 1 b = 2 ... Do something with them I

multiprocessing + atexit

2009-03-12 Thread Neal Becker
I have some code that uses atexit (remove old log files). Before converting to use multiprocessing, it worked. Since converting, it seems to not be running the atexit code (old log files are not removed). Any known issues with multiprocessing + atexit? --

Re: argument problem in optparse

2009-03-21 Thread Neal Becker
Qian Xu wrote: Hi All, I have a problem with OptParse. I want to define such an arugument. It can accept additional value or no value. myscript.py --unittest File1,File2 myscript.py --unittest Is it possible in OptParse? I have tried several combination. But ... Best regards

simple iterator question

2009-04-02 Thread Neal Becker
How do I interleave 2 sequences into a single sequence? How do I interleave N sequences into a single sequence? -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 382: Namespace Packages

2009-04-02 Thread Neal Becker
While solving this problem, is it possible also to address an issue that shows up in certain distributions? I'm specifically talking about the fact that on Redhat/Fedora, we have on x86_64 both /usr/lib/pythonxx/ and /usr/lib64/pythonxx. The former is supposed to be for non-arch specific

more fun with iterators (mux, demux)

2009-04-06 Thread Neal Becker
I'm trying to make a multiplexor and demultiplexor, using generators. The multiplexor will multiplex N sequences - 1 sequence (assume equal length). The demultiplexor will do the inverse. The mux seems easy enough: --- def mux (*ranges): iterables = [iter (r) for r

Re: more fun with iterators (mux, demux)

2009-04-08 Thread Neal Becker
pataphor wrote: On 07 Apr 2009 02:05:59 GMT Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: The demuxer can't be an iterator, since it needs to run through the entire collection. Then your demuxer obviously cannot handle infinite sequences. def demux(it, n):

python syntax for conditional is unfortunate

2008-09-23 Thread Neal Becker
In hindsight, I am disappointed with the choice of conditional syntax. I know it's too late to change. The problem is y = some thing or other if x else something_else When scanning this my eye tends to see the first phrase and only later notice that it's conditioned on x (or maybe not notice

Re: python syntax for conditional is unfortunate

2008-09-23 Thread Neal Becker
Aaron Castironpi Brady wrote: On Sep 23, 6:52 pm, Neal Becker [EMAIL PROTECTED] wrote: In hindsight, I am disappointed with the choice of conditional syntax. I know it's too late to change. The problem is y = some thing or other if x else something_else When scanning this my eye tends

add method to class dynamically?

2008-10-22 Thread Neal Becker
I have a class (actually implemented in c++ using boost::python). For an instance of this class, 'r', I'd like to support len (r). I don't want to add it to the c++ code, because this is a unique situation: this class should not normally support len(). So I try: r = ring_int (10) r.__len__ =

Re: add method to class dynamically?

2008-10-22 Thread Neal Becker
Diez B. Roggisch wrote: BTW, could you stop setting the followup-to to a non-existing (at least for a standard newsreader) gmane-newsgroup? Is this any better? -- http://mail.python.org/mailman/listinfo/python-list

email for gpg encrypted?

2008-11-06 Thread Neal Becker
I know we have 'email' module. Is there something I could use to produce properly mime-encoded gpg encrypted messages? -- http://mail.python.org/mailman/listinfo/python-list

[ctypes] convert pointer to string?

2008-05-21 Thread Neal Becker
In an earlier post, I was interested in passing a pointer to a structure to fcntl.ioctl. This works: c = create_string_buffer (...) args = struct.pack(iP, len(c), cast (pointer (c), c_void_p).value) err = fcntl.ioctl(eos_fd, request, args) Now to do the same with ctypes, I have one problem.

Re: [ctypes] convert pointer to string?

2008-05-21 Thread Neal Becker
[EMAIL PROTECTED] wrote: Neal Becker napisał(a): In an earlier post, I was interested in passing a pointer to a structure to fcntl.ioctl. This works: c = create_string_buffer (...) args = struct.pack(iP, len(c), cast (pointer (c), c_void_p).value) err = fcntl.ioctl(eos_fd, request, args

Re: [ctypes] convert pointer to string?

2008-05-21 Thread Neal Becker
[EMAIL PROTECTED] wrote: Neal Becker napisał(a): In an earlier post, I was interested in passing a pointer to a structure to fcntl.ioctl. This works: c = create_string_buffer (...) args = struct.pack(iP, len(c), cast (pointer (c), c_void_p).value) err = fcntl.ioctl(eos_fd, request, args

dynamically load from module import xxx

2008-07-01 Thread Neal Becker
What is a good way to emulate: from module import xxx where 'module' is a dynamically generated string? __import__ ('modulename', fromlist=['xxx']) seems to be what I want, but then it seems 'xxx' is not placed in globals() (which makes me wonder, what exactly did fromlist do?) --

Re: dynamically load from module import xxx

2008-07-01 Thread Neal Becker
Guilherme Polo wrote: On Tue, Jul 1, 2008 at 12:11 PM, Neal Becker [EMAIL PROTECTED] wrote: What is a good way to emulate: from module import xxx where 'module' is a dynamically generated string? __import__ ('modulename', fromlist=['xxx']) seems to be what I want, but then it seems 'xxx

profiling question

2008-07-10 Thread Neal Becker
Just to confirm, the profiling numbers (from cProfile) do include time spent inside my own C functions that I import as modules? -- http://mail.python.org/mailman/listinfo/python-list

decorator to prevent adding attributes to class?

2008-07-11 Thread Neal Becker
After spending the morning debugging where I had misspelled the name of an attribute (thus adding a new attr instead of updating an existing one), I would like a way to decorate a class so that attributes cannot be (easily) added. I guess class decorators are not available yet (pep 3129), but

Re: decorator to prevent adding attributes to class?

2008-07-11 Thread Neal Becker
Robert Bossy wrote: class Foo(Freezeable): def __init__(self): self.bar = 42 self.freeze() # ok, we set all variables, no more from here x = Foo() print x.bar x.bar = -42 print x.bar x.baz = OMG! A typo! Pretty nice, but unfortunately the subclass has to remember to call freeze in

python extra

2007-07-08 Thread Neal Becker
Just a little python humor: http://www.amazon.com/Vitamin-Shoppe-Python-Extra-tablets/dp/B00012NJAK/ref=sr_1_14/103-7715091-4822251?ie=UTF8s=hpcqid=1183917462sr=1-14 -- http://mail.python.org/mailman/listinfo/python-list

Re: python extra

2007-07-08 Thread Neal Becker
Danyelle Gragsone wrote: Nope.. not a one.. /sarcasm On 7/8/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Jul 8, 12:59?pm, Neal Becker [EMAIL PROTECTED] wrote: Just a little python humor: http://www.amazon.com/Vitamin-Shoppe-Python-Extra-tablets/dp/B00012NJ... Aren't there any

problem with change to exceptions

2007-07-27 Thread Neal Becker
import exceptions class nothing (exceptions.Exception): def __init__ (self, args=None): self.args = args if __name__ == __main__: raise nothing Traceback (most recent call last): File stdin, line 1, in module File /usr/tmp/python-3143hDH, line 5, in __init__ self.args =

Re: problem with change to exceptions

2007-07-27 Thread Neal Becker
Alex Popescu wrote: Neal Becker [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: import exceptions class nothing (exceptions.Exception): def __init__ (self, args=None): self.args = args if __name__ == __main__: raise nothing Traceback (most recent call last

interaction of 'with' and 'yield'

2007-07-31 Thread Neal Becker
I'm wondering if a generator that is within a 'with' scope exits the 'with' when it encounters 'yield'. I would like to use a generator to implement RAII without having to syntactically enclose the code in the 'with' scope, and I am hoping that the the yield does not exit the 'with' scope and

re: mmm-mode, python-mode and doctest-mode?

2007-08-08 Thread Neal Becker
Anyone testing on xemacs? I tried it, and C-c C-c sent xemacs into an infinite loop (apparantly). -- http://mail.python.org/mailman/listinfo/python-list

Re: mmm-mode, python-mode and doctest-mode?

2007-08-09 Thread Neal Becker
Edward Loper wrote: Anyone testing on xemacs? I tried it, and C-c C-c sent xemacs into an infinite loop (apparantly). It works fine for me in XEmacs 21.4 (patch 17) (i386-debian-linux, Mule). If you could answer a few questions, it might help me track down the problem: - What version

simple string formatting question

2007-12-14 Thread Neal Becker
I have a list of strings (sys.argv actually). I want to print them as a space-delimited string (actually, the same way they went into the command line, so I can cut and paste) So if I run my program like: ./my_prog a b c d I want it to print: './my_prog' 'a' 'b' 'c' 'd' Just print sys.argv

OpenOpt install

2007-12-16 Thread Neal Becker
What do I need to do? I have numpy, scipy (Fedora F8) cd openopt/ [EMAIL PROTECTED] openopt]$ python setup.py build running build running config_cc unifing config_cc, config, build_clib, build_ext, build commands --compiler options running config_fc unifing config_fc, config, build_clib,

ucs2 or ucs4?

2008-01-14 Thread Neal Becker
How do I tell if my python-2.5 is build with ucs2 or ucs4? -- http://mail.python.org/mailman/listinfo/python-list

Re: Gui front-end to version control program

2008-01-19 Thread Neal Becker
David Delony wrote: I spoke with Eric S. Raymond at a Linux user's group meeting a few days ago about the need for version control for end users. I thought that Python might be a good candidate for this. Luckily, Guido was there as well. I talked this over with him and he suggested using

index of min element of sequence

2008-01-21 Thread Neal Becker
What's a good/fast way to find the index of the minimum element of a sequence? (I'm fairly sure sorting the sequence is not the fastest approach) -- http://mail.python.org/mailman/listinfo/python-list

Re: Index of maximum element in list

2008-01-25 Thread Neal Becker
Henry Baxter wrote: Oops, gmail has keyboard shortcuts apparently, to continue: def maxi(l): m = max(l) for i, v in enumerate(l): if m == v: return i But it seems like something that should be built in - or at least I should be able to write a lambda

typename

2008-01-29 Thread Neal Becker
I want python code that given an instance of a type, prints the type name, like: typename (0) - 'int' I know how to do this with the C-api, (o-tp_name), but how do I do it from python? type(0) prints type 'int', not really what I wanted. -- http://mail.python.org/mailman/listinfo/python-list

MyHDL (was Re: Will Python on day replace MATLAB...)

2008-02-01 Thread Neal Becker
I was not aware of MyHDL, sounds interesting. But, last release was May 2006. I wonder if it still active? -- http://mail.python.org/mailman/listinfo/python-list

checkpoint/restart python processes

2008-02-01 Thread Neal Becker
Hi numeric processing fans. I'm pleased to report that you can now have convenient checkpoint/restart, at least if you are running fedora linux. Example: python -i blcr_mod.py this will start python, then checkpoint it c_int(2) (ignore this debug) [quit] cr_restart checkpoint.nbecker1.23768

Help with mechanize

2008-08-06 Thread Neal Becker
I'm trying to use mechanize to read for a M$ mail server. I can get past the login page OK using: import mechanize b = mechanize.Browser() b.open ('https://mail.hughes.com/owa/auth/logon.aspx?url=https://mail.hughes.com/OWA/reason=0') b.select_form(nr=0) b['username']='myname'

Find class of an instance?

2008-08-06 Thread Neal Becker
Sounds simple, but how, given an instance, do I find the class? -- http://mail.python.org/mailman/listinfo/python-list

bbfreeze problem

2008-08-08 Thread Neal Becker
Any ideas on this? bb-freeze test5-coded-pre.py WARNING: found xml.sax in multiple directories. Assuming it's a namespace package. (found in /usr/lib64/python2.5/site-packages/_xmlplus/sax, /usr/lib64/python2.5/xml/sax) *** applied function recipe_doctest at 0xc618c0 recipe_matplotlib: using

Re: python-mode is missing the class browser

2008-08-08 Thread Neal Becker
Alexander Schmolck wrote: Adam Jenkins [EMAIL PROTECTED] writes: On Fri, Aug 8, 2008 at 7:32 AM, Michele Simionato [EMAIL PROTECTED] wrote: On Aug 7, 5:55 pm, Alexander Schmolck [EMAIL PROTECTED] wrote: ... I have solved by using ipython.el which was already installed. For the sake of

posix semaphore support?

2008-08-29 Thread Neal Becker
Is there a posix semaphore wrapper for python? Would that be a good addition? -- http://mail.python.org/mailman/listinfo/python-list

Re: posix semaphore support?

2008-08-29 Thread Neal Becker
Christian Heimes wrote: Neal Becker wrote: Is there a posix semaphore wrapper for python? Would that be a good addition? The threading module provides a high level interface to native semaphores, e.g. pthread. Christian Does that provide semaphores between unrelated processes

help with pyparsing

2007-10-31 Thread Neal Becker
I'm just trying out pyparsing. I get stack overflow on my first try. Any help? #/usr/bin/python from pyparsing import Word, alphas, QuotedString, OneOrMore, delimitedList first_line = '[' + delimitedList (QuotedString) + ']' def main(): string = '''[ 'a', 'b', 'cdef']''' greeting =

Which persistence is for me?

2007-11-01 Thread Neal Becker
I need to organize the results of some experiments. Seems some sort of database is in order. I just took a look at DBAPI and the new sqlite interface in python2.5. I have no experience with sql. I am repulsed by e.g.: c.execute(insert into stocks values

Re: Which persistence is for me?

2007-11-01 Thread Neal Becker
Neal Becker wrote: I need to organize the results of some experiments. Seems some sort of database is in order. I just took a look at DBAPI and the new sqlite interface in python2.5. I have no experience with sql. I am repulsed by e.g.: c.execute(insert into stocks values

Re: Auto locate Python's .so on Linux (for cx_Freeze's --shared-lib-name)

2007-11-18 Thread Neal Becker
robert wrote: In a makefile I want to locate the .so for a dynamically linked Python on Linux. (for cx_Freeze's --shared-lib-name) e.g. by running a small script with that Python. How to? Robert How about run python -v yourscript and filter the output? --

struct,long on 64-bit machine

2007-11-19 Thread Neal Becker
What's wrong with this? type(struct.unpack('l','\00'*8)[0]) type 'int' Why I am getting 'int' when I asked for 'long'? This is on python-2.5.1-15.fc8.x86_64 -- http://mail.python.org/mailman/listinfo/python-list

which configparse?

2007-12-06 Thread Neal Becker
I have all my options setup with optparse. Now, I'd like to be able to parse an ini file to set defaults (that could be overridden by command line switches). I'd like to make minimal change to my working optparse setup (there are lots of options - I don't want to duplicate all the cmdline

Re: which configparse?

2007-12-06 Thread Neal Becker
Martin Marcher wrote: Hi, On 12/6/07, Neal Becker [EMAIL PROTECTED] wrote: configparse looks like what I want, but it seems last commit was 2years ago. What is the best choice? that seems like configparse is the best choice. Thanks. I see something right off that should be improved

Recommendations for writing a user guide with examples?

2007-12-08 Thread Neal Becker
I'm looking for recommendations for writing a user manual. It will need lots of examples of command line inputs and terminal outputs. I'd like to minimize the effort to integrate the terminal input/output into my document. I have lots of experience with latex, but I wonder if there may be some

Re: Compleated Begginers Guide. Now What?

2006-04-08 Thread Neal Becker
Maybe find a spell checker? -- http://mail.python.org/mailman/listinfo/python-list

Re: Automated Graph Plotting in Python

2006-04-10 Thread Neal Becker
Felipe Almeida Lessa wrote: Em Sáb, 2006-04-08 às 20:08 -0700, [EMAIL PROTECTED] escreveu: My python program spits lot of data. I take that data and plot graphs using OfficeOrg spredsheet. I want to automate this task as this takes so much of time. I have some questions. You can try

global destructor not called?

2007-06-15 Thread Neal Becker
To implement logging, I'm using a class: class logger (object): def __init__ (self, name): self.name = name self.f = open (self.name, 'w') def write (self, stuff): self.f.write (stuff) def close (self): self.f.close() def flush (self):

Re: global destructor not called?

2007-06-15 Thread Neal Becker
Bruno Desthuilliers wrote: Neal Becker a écrit : To implement logging, I'm using a class: If I may ask : any reason not to use the logging module in the stdlib ? Don't exactly recall, but needed some specific behavior and it was just easier this way. class logger (object): def

Is there a way to hook into module destruction?

2007-06-16 Thread Neal Becker
Code at global scope in a module is run at module construction (init). Is it possible to hook into module destruction (unloading)? -- http://mail.python.org/mailman/listinfo/python-list

block scope?

2007-04-06 Thread Neal Becker
One thing I sometimes miss, which is common in some other languages (c++), is idea of block scope. It would be useful to have variables that did not outlive their block, primarily to avoid name clashes. This also leads to more readable code. I wonder if this has been discussed? --

Re: block scope?

2007-04-07 Thread Neal Becker
James Stroud wrote: Paul Rubin wrote: John Nagle [EMAIL PROTECTED] writes: In a language with few declarations, it's probably best not to have too many different nested scopes. Python has a reasonable compromise in this area. Functions and classes have a scope, but if and for do not.

code check for modifying sequence while iterating over it?

2007-08-31 Thread Neal Becker
After just getting bitten by this error, I wonder if any pylint, pychecker variant can detect this error? -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   >