Pickle for MPI

2005-12-06 Thread tooper
Hello,

Did anybody tried python pickle module over heterogeneous 32/64 bits
mpi exchanges to overcome the translation problem ? i.e. pickling on
one side (let's say a 32-bits OS side), sending the buffer as string
through mpi and unpickling on the other side (let's say a 64-bits OS
side)


Any well known pitfall or advice before I try this way would be welcome
! 
Thanks a lot in advance ! 
Regards, 
Thierry

-- 
http://mail.python.org/mailman/listinfo/python-list


Inheritance problem ?

2005-08-24 Thread tooper
Hello all,

I'm trying to implement a common behavior for some object that can be
read from a DB or (when out of network) from an XML extract of this DB.
I've then wrote 2 classes, one reading from XML & the other from the
DB, both inheritating from a common one where I want to implement
several common methods.
Doing this, I've come to some behaviour I can't explain to myself,
which I've reproduced in the example bellow :

-

class myfather:
def __repr__(self):
return "\t a="+self.a+"\n\t b="+self.b

class mychilda(myfather):
def __init__(self,a):
self.a= a
def __getattr__(self,name):
return "Undefined for mychilda"

class mychildb(myfather):
def __init__(self,b):
self.b= b
def __getattr__(self,name):
return "Undefined for mychildb"

a= mychilda("a")
b= mychildb("b")

print "a:\n"+str(a)
print "b:\n"+str(b)

-

I was expecting to get :

a:
   a= a
   b= Undefined for mychilda
b:
   a= Undefined for mychildb
   b= b

but I get the following error :

File "/home/thierry/mytest.py", line 20, in ?
print "a:\n"+str(a)
TypeError: 'str' object is not callable

Could someone explain me what I missed ?

Thanks in advance !

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: execfile in global scope

2005-08-24 Thread tooper
What about :

globdict= globals()

def changevar():
global globdict
execfile("changevar.py",globdict)

x = 111   # global var
changevar() 
print x   # returns 111 instead of 555

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: execfile in global scope

2005-08-24 Thread tooper
What about :

globdict= globals()

def changevar():
global globdict
execfile("changevar.py",globdict)

x = 111   # global var
changevar() 
print x   # returns 111 instead of 555

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Variables in REs

2005-08-24 Thread tooper
Use os.sep to get / or \ or whatever character used to build pathes on
the os you're working on

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Inheritance problem ?

2005-08-24 Thread tooper
Thanks, at least makes it running !
I'll have to teach myself to move to this new style classes by default
anyway...

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Inheritance problem ?

2005-08-24 Thread tooper
Not always easy to follow but great !
Using __str__ instead of __repr__ makes it work also with old style
(thanks to Simon Brunning for suggesting it, and with your link I even
now understand why !)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python xml DOM? pulldom? SAX?

2005-08-29 Thread tooper
Hi,

I'd advocate for using SAX, as DOM related methods implies loading the
complete XML content in memory whereas SAX grab things on the fly.
SAX method should therefore be faster and less memory consuming...

By the way, if your goal is to just "combine the text out of page:title
and page:revision:text for every single page element", maybe you should
also consider an XSLT filter.

Regards,
Thierry

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python port on Palm Treo?

2005-08-30 Thread tooper
I'm not aware of any Treo dedicated port, but as Treo is running Palm,
the Palm port of Python should be OK (if I remember well it's pypi or
pipy, standing for PYthon for palm PIlot)
Hope it helps...

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python port on Palm Treo?

2005-08-30 Thread tooper
I'm not aware of any Treo dedicated port, but as Treo is running Palm,
the Palm port of Python should be OK (if I remember well it's pypi or
pipy, standing for PYthon for palm PIlot)
Hope it helps...

-- 
http://mail.python.org/mailman/listinfo/python-list


using python_ldap for authentication

2005-08-31 Thread tooper
Hello all,

I'd like to use an ldap server just for authentication, but I'm a
complete beginner with all the ldap stuff...

I've tried this from the python_ldap Demo examples :

--
import ldap, getpass

ldap_url="... validation ldap server URL & port ..."
l = ldap.initialize(ldap_url)

login_dn = "cn=thierry"
login_pw = getpass.getpass("Password for %s: " % login_dn)
l.simple_bind(login_dn, login_pw)
--

but it seems to succeed whatever the password I'm providing :-(

How to simply assess the binding really occured ?
Do I need to start doing stuff with the "l" object to catch an error
and realize I'm not in fact connected : that's my current workaround
but I'm not very proud of it...

Thanks in advance !

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: graphical or flow charting design aid for python class development?

2005-08-31 Thread tooper
You may want to use Doxygen, which generates nice diagrams. It's
normally only for C++, but there are nice filters (for ex.
http://i31www.ira.uka.de/~baas/pydoxy) that generates C++ header from
python code that Doxygen can crunch.

Another solution is to use IDE such as Eric3 that can generate UML
diags from source code on the fly.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Extend Python

2005-09-01 Thread tooper
PyQT is using SIP to wrap Qt : looks nice and works great for PyQt
which is a quite big wrapping. Never had the occation to use it myself
however, except for this.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Where do .pyc files come from?

2005-09-09 Thread tooper
Yes, these are bytecode files.
If you run "python -o", you should also get .pyo files for optimized
bytecode. As long as you do not modify the source code, python directly
reuse the bytecode (that's also a way to distribute script without
source code to avoid your users fiddling in thecode and make it not
work properly - even if any advanced user will know how to revert back
to source code)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Launching Python programs from Linux shell script

2005-09-09 Thread tooper
Yes, provided your python interpreter is installed, and in your path
("$ whereis python" should give you something like /usr/bin/python or
/usr/local/bin/python)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Launching Python programs from Linux shell script

2005-09-09 Thread tooper
Yes, provided your python interpreter is installed, and in your path
("$ whereis python" should give you something like /usr/bin/python or
/usr/local/bin/python)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python-soappy

2006-01-11 Thread tooper
On the client side :
 from SOAPpy import SOAPProxy
 server= SOAPProxy("http://foo.bar.org:8090";)
 print server.Hello("world")

On the server side :
 from SOAPpy import SOAPServer

 def Hello(name):
return "Hello "+name+" !"

 server= SOAPServer(("localhost",8080))
 server.registerFunction(Hello)
 server.serve_forever()

-- 
http://mail.python.org/mailman/listinfo/python-list


Registering COM python based components when not admin

2006-01-18 Thread tooper
Hello,

I'm failing to register a python based COM component without having
admin rights...

Using the usual hello world COM server that exist in many
books/tutorial, and works perfecty when tested as admin, I first faced
problems to write in registry as normal user.

Some inspection of win32com.server.register shows a default argument I
missed in the documentation "base=win32con.HKEY_CLASSES_ROOT" for most
calls to set things in registry.

Forcing it to HKEY_CURRENT_USER seems to help for most of the initial
complaining _set_subkeys (and I've checked with regedit that
declaration in registry was effectively started), but a little after I
fail on the following :
  File "C:\...\register.py", line 269, in RegisterServer
regCat.RegisterClassImplCategories(clsid, catids)
pywintypes.com_error: (-2147024891, 'Acc\xe8s refus\xe9.', None, None)

Unfortunately for me, regCat is a PyICatRegister object returned by
_cat_registrar, coming from a call to pythoncom.CoCreateInstance and
there's no source code I've found for pythoncom (looks it's a compiled
DLL). I tried to add base=win32con.HKEY_CURRENT_USER to
CoCreateInstance call but it complains there are no names args.

Any chance pythoncom is bluntly trying to write in HKEY_CLASSES_ROOT
tree just like register does ?
Any ideas or known workaround ?

Thanks in advance !

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: tools to manipulate PDF document?

2006-01-19 Thread tooper
Try reportlab PDF library (www.reportlab.org). Many things for graphs
but also basic handling. Works fast & reliably for my requirements.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Registering COM python based components when not admin

2006-01-19 Thread tooper
Thanks for the hint !

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Oddities of Tkinter

2006-01-25 Thread tooper
Tuvas,

I fully agree with Eric's post above. You may additionnaly have to kill
the main window before exit, to avoid a nasty thread related error
message and occasionally some zombie procs:

import Tkinter,atexit
top=Tkinter.Tk()
.../...
atexit.register(lambda top=top: top.destroy())
top.mainloop()

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: cx_Oracle string problems...

2006-02-13 Thread tooper
Looks like a space is missing before VALUES keyword ?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python advocacy in scientific computation

2006-02-28 Thread tooper
Maybe I'd also emphasize the nice COM interface that allow your wrapped
Fortran to be made available in your Excel macros in a snap. It happens
that Fortran programmers/users tends to be poor Office users except for
Excel which they master at unbelievable level...
My own best low work/high user satisfaction ever is just this, wrap
LOWTRAN call to make is usable from Excel, a 1/2h work and a 100+ users
2 days later !

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Drawing charts and graphs.

2006-04-26 Thread tooper
I'm quite satisfied with MatPlotLib for scientific plotting. ReportLab
has also a very good package for high quality PDF production incl.
graphics.
For more interactive, Grace plotter has a good Graceplot.py python
front-end.

-- 
http://mail.python.org/mailman/listinfo/python-list