mimms problem on Hardy

2008-09-05 Thread kaer
Hello,

I installed (manually) the last version of mimms -which is a python
program- on an Ubuntu (8.04-server) box.
I get that:

[EMAIL PROTECTED]:~/mimms-3.2$ mimms
Traceback (most recent call last):
  File "/usr/bin/mimms", line 21, in 
from libmimms.core import run
  File "/usr/lib/python2.5/site-packages/libmimms/core.py", line 31,
in 
from . import libmms
  File "/usr/lib/python2.5/site-packages/libmimms/libmms.py", line 29,
in 
libmms.mmsx_connect.argtypes = [c_void_p, c_void_p, c_char_p,
c_int]
  File "/usr/lib/python2.5/ctypes/__init__.py", line 361, in
__getattr__
func = self.__getitem__(name)
  File "/usr/lib/python2.5/ctypes/__init__.py", line 366, in
__getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /usr/lib/libmms.so.0: undefined symbol

If it helps:
[EMAIL PROTECTED]:~/mimms-3.2$ ls -l /usr/lib/libmms.so.0
lrwxrwxrwx 1 root root 15 2008-08-20 01:41 /usr/lib/libmms.so.0 ->
libmms.so.0.0.2: mmsx_connect

If have no idea where the problem is. Thanks for your ideas,
suggestions, comments ...
--
http://mail.python.org/mailman/listinfo/python-list


Re: mimms problem on Hardy

2008-09-05 Thread kaer
On 5 sep, 22:15, kaer <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I installed (manually) the last version of mimms -which is a python
> program- on an Ubuntu (8.04-server) box.
> I get that:
>
> [EMAIL PROTECTED]:~/mimms-3.2$ mimms
> Traceback (most recent call last):
>   File "/usr/bin/mimms", line 21, in 
> from libmimms.core import run
>   File "/usr/lib/python2.5/site-packages/libmimms/core.py", line 31,
> in 
> from . import libmms
>   File "/usr/lib/python2.5/site-packages/libmimms/libmms.py", line 29,
> in 
> libmms.mmsx_connect.argtypes = [c_void_p, c_void_p, c_char_p,
> c_int]
>   File "/usr/lib/python2.5/ctypes/__init__.py", line 361, in
> __getattr__
> func = self.__getitem__(name)
>   File "/usr/lib/python2.5/ctypes/__init__.py", line 366, in
> __getitem__
> func = self._FuncPtr((name_or_ordinal, self))
> AttributeError: /usr/lib/libmms.so.0: undefined symbol
>
> If it helps:
> [EMAIL PROTECTED]:~/mimms-3.2$ ls -l /usr/lib/libmms.so.0
> lrwxrwxrwx 1 root root 15 2008-08-20 01:41 /usr/lib/libmms.so.0 ->
> libmms.so.0.0.2: mmsx_connect
>
> If have no idea where the problem is. Thanks for your ideas,
> suggestions, comments ...

I should have posted the some code of core.py:

"""
This module uses ctypes to interface to libmms. Currently, it just
exposes the mmsx interface, since this one is the most flexible.
"""

from ctypes import *

libmms = cdll.LoadLibrary("libmms.so.0")

# opening and closing the stream
libmms.mmsx_connect.argtypes = [c_void_p, c_void_p, c_char_p, c_int]
libmms.mmsx_connect.restype = c_void_p

libmms.mmsx_close.argtypes = [c_void_p]
libmms.mmsx_close.restype = None


And so on ...

If I comment the mmsx_connect lines, I have the same problem with the
mmsx_close ones ...
If somebody has an idea on how debug a ctypes problem, it would be
very helpful.
--
http://mail.python.org/mailman/listinfo/python-list


Re: running python as a dameon

2008-09-06 Thread kaer
On 6 sep, 15:44, Michael Palmer <[EMAIL PROTECTED]> wrote:
> On Sep 5, 9:56 pm, Sean Davis <[EMAIL PROTECTED]> wrote:
>
>
>
> > > What I want
> > > to do is to provide the python NLP program as a service to any other
> > > PHP/Java/Ruby process request. So the mapping is
>
> > > http -> apache -> PHP/Java/Ruby/... -> Python NLP
>
> > Why not use a simple CGI script or wsgi application?  You could make
> > the service online and interactive and with the same application and
> > code make an XMLRPC web service.  So, things would look more like:
>
> > http -> apache -> Python (running NLP and serving requests)
>
> > You can use apache to proxy requests to any one of a dozen or so
> > python-based webservers.  You could also use mod_wsgi to interface
> > with a wsgi application.
>
> > Sean
>
> xmlrpc is the right idea, as it interfaces easily across languages.

I just daemonize some utility script these week. For that I took one
of the scripts in the ASPN python cookbook : google those 3 words then
search python and you will find out your solution faster than I end up
this mail. It worked like a charm on my linux box.
BTW, I wouldn't complicate with xml stuffs if you don't need it.

Good luck.


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


Re: running python as a dameon

2008-09-06 Thread kaer
On 6 sep, 22:16, kaer <[EMAIL PROTECTED]> wrote:
> On 6 sep, 15:44, Michael Palmer <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Sep 5, 9:56 pm, Sean Davis <[EMAIL PROTECTED]> wrote:
>
> > > > What I want
> > > > to do is to provide the python NLP program as a service to any other
> > > > PHP/Java/Ruby process request. So the mapping is
>
> > > > http -> apache -> PHP/Java/Ruby/... -> Python NLP
>
> > > Why not use a simple CGI script or wsgi application?  You could make
> > > the service online and interactive and with the same application and
> > > code make an XMLRPC web service.  So, things would look more like:
>
> > > http -> apache -> Python (running NLP and serving requests)
>
> > > You can use apache to proxy requests to any one of a dozen or so
> > > python-based webservers.  You could also use mod_wsgi to interface
> > > with a wsgi application.
>
> > > Sean
>
> > xmlrpc is the right idea, as it interfaces easily across languages.
>
> I just daemonize some utility script these week. For that I took one
> of the scripts in the ASPN python cookbook : google those 3 words then
> search python and you will find out your solution faster than I end up
> this mail. It worked like a charm on my linux box.
> BTW, I wouldn't complicate with xml stuffs if you don't need it.
>
> Good luck.

you obviously "search daemon" not "search python". Her is the link:
http://www.google.com/search?q=daemon&hl=en&ie=UTF-8&btnG=Google%2BSearch&qdr=all&occt=any&dt=i&sitesearch=code.activestate.com
--
http://mail.python.org/mailman/listinfo/python-list


Re: unexpected class behaviour

2008-09-07 Thread kaer
On 7 sep, 12:40, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> Jan Schäfer wrote:
> > can anyone explain the behaviour of the following code sniplet:
>
> well, it *is* explained in the tutorial, the language reference, and the
> FAQ, so yes, it can be explained ;-)
>
> for more information, see this page:
>
>  http://effbot.org/zone/default-values.htm
>
> 

Well, you may want replace the last line by:
print ivar, obj, obj.varlist, id(obj.varlist)

To have another behavior, you may want replace the 3 first lines by:
class Base(object):
def __init__( self, lst=None ):
if lst is None: lst=[]
self.varlist = lst

Enjoy Python !
--
http://mail.python.org/mailman/listinfo/python-list


Re: wxpython ms-dos black window popping up in background

2008-09-09 Thread kaer
On 9 sep, 23:35, icarus <[EMAIL PROTECTED]> wrote:
> Oh ok. Thanks. In windows xp I just renamed the file extension to .pyw
> That did it.
>
> one more question...
>
> how do I create a pythonw standalone executable that works on w32,
> linux, mac, etc..?
>
> My intent is to have the process transparent to the user. He wouldn't
> even know the app was written in python. All he knows that when he
> double-clicks on it, the application pops up without the DOS black
> screen in the background (for w32 users.)
>
> On Sep 9, 10:49 am, "Chris Rebert" <[EMAIL PROTECTED]> wrote:
>
> > You need to have the script be run by pythonw.exe as opposed to python.exe
> > pythonw.exe suppresses the DOS box from coming up and should be used
> > for running GUI applications such as yours.
>
> > Regards,
> > Chris
>
> > On Tue, Sep 9, 2008 at 1:33 PM, icarus <[EMAIL PROTECTED]> wrote:
> > > platform: windows xp professional, python 2.5, wxpython
>
> > > When I double-check on my program file test.py (for simplicity I'll be
> > > using this code below), I see the window just fine.  But the ms-dos
> > > black window pops up in the background. On Linux, no issues at all.
>
> > > How can I get rid of that ms-dos black window in the background?
> > > something I need to add to my code? a setting to adjust in windows?
> > > thanks in advance.
>
> > > #!/usr/bin/python
> > > import wx
>
> > > appwx = wx.App()
>
> > > frame = wx.Frame(None, -1, 'test.py')
> > > frame.Show()
>
> > > appwx.MainLoop()
> > > --
> > >http://mail.python.org/mailman/listinfo/python-list
>
> > --
> > Follow the path of the Iguana...http://rebertia.com

py2exe could be what you are looking for.
--
http://mail.python.org/mailman/listinfo/python-list


Re: I want to use a C++ library from Python

2008-09-10 Thread kaer
On 10 sep, 10:00, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> Anders Eriksson schrieb:
>
> > Hello,
>
> > I have a C++ library compiled as Windows DLL's. It consists of 32 .h and 1
> > .lib and 1 .dll files. I don't have the source code.
>
> > How can I create a Python module from these files?
>
> Did you bother googling?
>
> http://www.google.de/search?q=python+c%2B%2B&ie=utf-8&oe=utf-8
>
> Diez

You may want google "python dll" as well. Good luck.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Python newbie

2008-09-19 Thread kaer
On 19 sep, 10:13, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> On Fri, 19 Sep 2008 09:13:48 +0200, Mladen Gogala wrote:
> > I am a Python newbie who decided to see what that Python fuss is all
> > about. Quite frankly, I am a bit perplexed., here is what perplexes me:

> > perl -e '@a=(1,2,3); map { $_*=2 } @a; map { print "$_\n"; } @a;'


>
> Naturally you will be perplexed if you assume that Python is just Perl
> with a more verbose syntax. It isn't.
>

Indeed, it isn't ... at all:
$ python -c 'for s in [2*x for x in (1, 2, 3)]: print s'
2
4
6

And it's always (a lot) more readable :-)

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


Parse and clean odt docs: with lxml ? hints to start ?

2010-06-04 Thread kaer
Basically, I have to upgrade a website with a lot of new content. I
received those docs in the openoffice format.  If I open and save one
of those documents in the html format, I can cut and paste the result
in the html page, it's not that bad as a start but I need to clean
that html (remove tags, remove or change attributes, ...). My first
idea is to use lxml for that. My questions:
- is there a better way ?
- is lxml the right tool for that ?
- some examples of code for doing that ?

Have a nice day.
-- 
http://mail.python.org/mailman/listinfo/python-list