exec, import and isinstance

2011-02-08 Thread Michele Petrazzo
Hi all, I'm playing with python internals and I'm discovering a strange behavior of isinstance. Considering the following test case: test/bar.py test/b.py test/a/__init__.py test/a/foo.py -- __init__.py - empty --- foo.py: class foo: pass c = foo --- b.py def ret(): d = {} #s = import

Re: Computer Music Toolkit (CMT) ?

2010-01-11 Thread Michele Petrazzo
Terry Reedy wrote: On 1/10/2010 4:15 AM, Peter Billam wrote: Greetings. Is there a way to get at the Computer Music Toolkit (CMT) http://www.ladspa.org/cmt/ functionality from Python (Python3 in my case) ? You can access compiled C shared libraries most easily via the ctypes module. so if

Re: PIL and Python

2009-08-21 Thread Michele Petrazzo
catafest wrote: I don't extract data from jpegs. I wanna put some data in this (copyright of my site) ... My wrap for freeimage, called freeimagepy :) can't, as now, wrote exif information on the image, but since freeimage can do it, I think that it's not so difficult to add this type of

python 3 and stringio.seek

2009-07-28 Thread Michele Petrazzo
Hi list, I'm trying to port a my library to python 3, but I have a problem with a the stringio.seek: the method not accept anymore a value like pos=-6 mode=1, but the old (2.X) version yes... The error: File /home/devel/Py3/lib/python3.0/io.py, line 2031, in seek return self._seek(pos,

Re: try except inside exec

2009-05-31 Thread Michele Petrazzo
Emile van Sebille wrote: Write the string out to a .py file and import it? I don't think that it's possible. I want to create an env that are accessible only from that peace of code and not from the code that execute the third-party one. Emile Michele --

Re: try except inside exec

2009-05-31 Thread Michele Petrazzo
David Stanek wrote: Is the thirdparty function the entire STR or just the a_funct part? Just the a_funct. Only for try and for see if it's possible to catch all the (possible) exception(s), I add the try/except clause that include the a_funct external code. Michele --

Re: try except inside exec

2009-05-31 Thread Michele Petrazzo
Aaron Brady wrote: Exceptions are only caught when raised in a 'try' statement. If you don't raise the exception in a try statement, it won't be caught. The function you posted will raise an exception. If you are making the call yourself, that is, if only the definition is foreign, then

Re: subprocess and PPID

2008-11-06 Thread Michele Petrazzo
Lawrence D'Oliveiro wrote: In message [EMAIL PROTECTED], Michele Petrazzo wrote: I have a code that execute into a Popen a command (ssh). I need that, if the python process die, the parent pid (PPID) of the child don't become 1 (like I can seen on /proc/$pid$/status ), but it has to die

Re: subprocess and PPID

2008-11-06 Thread Michele Petrazzo
[EMAIL PROTECTED] wrote: It's possible in linux and with subprocess? AFAIK, there is no easy way to do this. If the parent python process is doing a controlled exit, just kill the child via close() on Popen() handle. Like I do ;) If the parent is doing a uncontrolled exit (say via a

subprocess and PPID

2008-11-05 Thread Michele Petrazzo
Hi all, I believe that this is a *nix question, but since I'm developing in python, I'm here. I have a code that execute into a Popen a command (ssh). I need that, if the python process die, the parent pid (PPID) of the child don't become 1 (like I can seen on /proc/$pid$/status ), but it has to

Re: subprocess and PPID

2008-11-05 Thread Michele Petrazzo
Jorgen Grahn wrote: On Wed, 5 Nov 2008 08:19:34 -0800 (PST), [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Nov 5, 5:12 pm, Michele Petrazzo [EMAIL PROTECTED] wrote: Hi all, I believe that this is a *nix question, but since I'm developing in python, I'm here. I have a code that execute

overwrite set behavior

2008-09-04 Thread Michele Petrazzo
Hi all, I want to modify the method that set use for see if there is already an object inside its obj-list. Something like this: class foo: pass bar1 = foo() bar1.attr = 1 bar2 = foo() bar2.attr = 1 set( (bar1, bar2), key=lambda o: o.attr) and, of course, set has only one value. It's

Re: overwrite set behavior

2008-09-04 Thread Michele Petrazzo
Marco Bizzarri wrote: looking at the source, maybe you could create a subclass of Set redefining the __contains__ method? Made some tries, but __contains__ are never called class foo(set): ... def __contains__(self, value): ... print value ... a = foo((1,2)) Thanks, Michele --

Re: Python multimap

2008-08-27 Thread Michele Petrazzo
brad wrote: Recently had a need to us a multimap container in C++. I now need to write equivalent Python code. How does Python handle this? k['1'] = 'Tom' k['1'] = 'Bob' k['1'] = 'Joe' Same key, but different values. No overwrites either They all must be inserted into the container

Re: annoying dictionary problem, non-existing keys

2008-04-24 Thread Michele Petrazzo
bvidinli wrote: i use dictionaries to hold some config data, such as: conf={'key1':'value1','key2':'value2'} and so on... when i try to process conf, i have to code every time like: if conf.has_key('key1'): if conf['key1']'': other commands this is very annoying. in php, i was able to

C to python conversion

2008-04-12 Thread Michele Petrazzo
Hi all, I'm trying to translate a simple C code into a python + ctypes (where need), but I have some problems on char conversion. The code have to work on Linux and talk with the serial port. I think that the problem is that I don't translate correctly the strings. C code: #define START 0x33

Strange problems with subprocess

2007-08-01 Thread Michele Petrazzo
Hi all. I have a simple ping tester program that, every 1 minute (execute by linux crontab), create, with subprocess, a ping -c 1 my_addrs. All work, but sometime (about 1/2 times at a day), I receive this error message: File /exports/srv-wipex/net_test/ping_tester.py, line 88, in pyPing cmd_p

Re: Strange problems with subprocess

2007-08-01 Thread Michele Petrazzo
[EMAIL PROTECTED] wrote: This doesn't look like a complete traceback. It doesn't give what the error was. Forgot a line, sorry! exceptions.OSError: [Errno 4] Interrupted system call Mike Michele -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning to use wxPython

2007-04-27 Thread Michele Petrazzo
KDawg44 wrote: Hi, Hi, I downloaded the wxPython demo and did an emerge wxpython (gentoo) to install. When I run the demo, I am getting this error: # python demo.py Traceback (most recent call last): File /usr/lib/python2.4/site-packages/wx-2.6-gtk2-ansi/wx/ _misc.py, line 1286, in

Re: Making GIF image twice the size - in memory

2007-03-23 Thread Michele Petrazzo
Miki wrote: Hello All, Heelo, I get an image from a web page (via urlopen), and like to make it twice the size. -cut- However I don't get a valid GIF image. Your code work well here! Why you said that the string are invalid? --code: test_image_double.py from urllib import urlopen

Re: failed to install PIL in fedora core 6

2007-02-24 Thread Michele Petrazzo
Frank Potter wrote: I use python setup.py install to install PIL in fedora with python 2.4, But I got these errors: -cut some errors- error: Python.h: No such file or directory In file included from libImaging/Imaging.h:14, from _imaging.c:78: So you don't have the python-dev package.

Re: beep or sound playing under linux

2007-01-23 Thread Michele Petrazzo
hg wrote: Hi, Is there a way to do that ? I can do it, into my debian, with a: michele:~$ echo -e \007 /dev/tty It's very simple to reproduce it with python and os.system or subprocess. Michele -- http://mail.python.org/mailman/listinfo/python-list

Re: wxWindows off-screen?

2007-01-05 Thread Michele Petrazzo
Ivan Voras wrote: Is it possible to draw a widget or a window in an off-screen buffer? (Assuming that you are on linux.) wxWigets (wxWindows is the old name) or better, since if you are on a python ng, wxPython :), can't be used if you are on a not-X machine: michele:~$ env | grep DIS

optparser question

2006-12-22 Thread Michele Petrazzo
I'm trying optparse and I see a strange (for me) behavior: def store_value(option, opt_str, value, parser): setattr(parser.values, option.dest, value) parser = optparse.OptionParser() parser.add_option(-f, --foo, action=callback, callback=store_value,

Re: optparser question

2006-12-22 Thread Michele Petrazzo
Steven Bethard wrote: You can try using argparse_, which doesn't make these weird inferences, and generally assumes that your action will take a single argument unless you specify otherwise:: -cut- Not sure exactly what your callback was trying to do though -- it seems like you're just

Re: FreeImagePy creating thumbnails from TIFF

2006-10-31 Thread Michele Petrazzo
[EMAIL PROTECTED] wrote: I a trying to create a series of thumbnail images from a multpage TIFF file. The sample code is below. When it executes, we get the following error; FreeImagePy.constants.FreeImagePy_ColorWrong: 'Wrong color 1 in function: FreeImage_MakeThumbnail. I can use: (8,

Execute external code and get return value

2006-09-29 Thread Michele Petrazzo
Hi, I want to execute an external code, that become from a text file (pe), call a function inside it and get its return value: # ext_code.txt def funct2Call(): return True # test.py sourcecode = open(ex_code.txt).read() comp_code = compile(sourcecode, My_test, exec) #do something like this

Re: Execute external code and get return value

2006-09-29 Thread Michele Petrazzo
Michele Petrazzo wrote: Auto reply: I find this: http://tinyurl.com/nwbpk Following this link, here is my solution: code = def funct2Call(): return It work! object.method(funct2Call) class Object(object): def method(self, value): self._callable = value def __call__

Re: Execute external code and get return value

2006-09-29 Thread Michele Petrazzo
Peter Otten wrote: Michele Petrazzo wrote: I want to execute an external code, that become from a text file (pe), call a function inside it and get its return value: namespace = {} execfile(ext_code.txt, namespace) print namespace[funct2Call]() Sorry, I forgot to say that ext_code.txt

Re: Decoding group4 tiff with PIL

2006-09-27 Thread Michele Petrazzo
Filipe wrote: Is decoding group4 tiff possible with Python Imaging Library? Not natively: http://mail.python.org/pipermail/image-sig/2003-July/002354.html [1] http://effbot.python-hosting.com/file/stuff/sandbox/pil/libtiff.py [2] http://www.haynold.com/software_projects/2004/pytiff/ Any

Re: PIL cannot open TIFF image in Windows

2006-09-11 Thread Michele Petrazzo
Rob Williscroft wrote: I downloaded some test images from: url:http://www.remotesensing.org/libtiff/images.html I do the same and modified your code for try FreeImagePy and the results are: ok: 41 error: 20 total: 61 Better than PIL, but a lot of problems with

Re: py2exe: cannot identify image file

2006-08-21 Thread Michele Petrazzo
Daniel Mark wrote: Hello all: It seems that function 'Image.open' cannot read image file under EXE application. What should I do for this problem? google and pil py2exe, the first reply: http://starship.python.net/crew/theller/moin.cgi/PIL_20and_20py2exe Thank you -Daniel Michele

Re: Python for EXIF-info-additions ?

2006-08-21 Thread Michele Petrazzo
Bror Johansson wrote: Is there somewhere some Python-module that can be used for adding EXIF-info to JPEG files? (Modules for extraction of EXIF-data are easily found, but lacks - as I see it - capacity to add new tags.) Hi, this is a feature that I want to add to FreeImagePy. It's not so

Re: Python for EXIF-info-additions ?

2006-08-21 Thread Michele Petrazzo
Bruno Dilly wrote: I think you can find what do you need into this repository, it's a creative commons tool: https://svn.berlios.de/svnroot/repos/cctools/publisher/branches/flickr-storage-branch/ take a look in the follow directory: ccpublisher/jpeg/ I'm not sure if it's what you

look for a module without import it

2006-07-14 Thread Michele Petrazzo
Hi list, I have to know if a module are present on the system, but I don't want to import it. Only know if it is present. I think that a loop on the site-packages directory can do the work, but is there another solution? Thanks, Michele -- http://mail.python.org/mailman/listinfo/python-list

Re: look for a module without import it

2006-07-14 Thread Michele Petrazzo
Fredrik Lundh wrote: more module.py print I'M MODULE! python import imp imp.find_module(os) It was! Michele -- http://mail.python.org/mailman/listinfo/python-list

Re: string replace

2006-07-01 Thread Michele Petrazzo
[EMAIL PROTECTED] wrote: Check out the .translate method and the string.maketrans documentation. You can use it to delete a list of characters all in one line: Yes. This is, more or less, what I were looking for. P.s. Sure, if replace could accept a tuple... :) Thanks to all, Michele --

Re: python for windows internet filter / firewall

2006-06-30 Thread Michele Petrazzo
[EMAIL PROTECTED] wrote: Greetings, I'm interested in a simple content-based internet firewall/filter, similar to dansguardian (http://dansguardian.org/), Firewall and filter are two things totally separated! - If you want to do something like a page filtering, like dansguard and

Way for see if dict has a key

2006-06-30 Thread Michele Petrazzo
Hi ng, what the preferred way for see if the dict has a key? We have a lot of solutions: key in dict key in dict.keys() dict.has_key(key) ... but what the better or the more pythonic? Thanks, Michele -- http://mail.python.org/mailman/listinfo/python-list

Re: Way for see if dict has a key

2006-06-30 Thread Michele Petrazzo
Fredrik Lundh wrote: Michele Petrazzo wrote: what the preferred way for see if the dict has a key? We have a lot of solutions: key in dict new syntax (2.3 and later). So, following it, it can be used for the operations like len? len(dict) - len(dict.keys()) ? Thanks, Michele

Re: Way for see if dict has a key

2006-06-30 Thread Michele Petrazzo
Bruno Desthuilliers wrote: but what the better Depends on the context. If know only one context: see if the key are into the dict... What other context do you know? Michele -- http://mail.python.org/mailman/listinfo/python-list

Re: Way for see if dict has a key

2006-06-30 Thread Michele Petrazzo
Fredrik Lundh wrote: Michele Petrazzo wrote: key in dict new syntax (2.3 and later). So, following it, it can be used for the operations like len? what's it in this sentence? It, is the thought that the new 2.3 introduce. Michele -- http://mail.python.org/mailman/listinfo/python-list

Re: delete first line in a file

2006-06-30 Thread Michele Petrazzo
Juergen Huber wrote: but...how can i say python, delete the first line?! thats my problem! You can open the file, read its lines with readlines function ( that return a list), so make your modifies and save to another file. Now, do you know how to work with lists?

Re: Way for see if dict has a key

2006-06-30 Thread Michele Petrazzo
André wrote: Michele Petrazzo wrote: Bruno Desthuilliers wrote: but what the better Depends on the context. If know only one context: see if the key are into the dict... What other context do you know? Michele Perhaps Bruno meant this: try: ... my_dict[key] ... except

string replace

2006-06-30 Thread Michele Petrazzo
Hi, a lot of times I need to replace more than one char into a string, so I have to do something like value = test chars = e for c in chars: value = value.replace(c, ) A solution could be that replace accept a tuple/list of chars, like that was add into the new 2.5 for startswith. I don't

Re: python for windows internet filter / firewall

2006-06-30 Thread Michele Petrazzo
[EMAIL PROTECTED] wrote: Thanks for a detailed reply. I thing that now we are becoming OT... :) because is restricts traffic on a port based on content, but you're correct, they aren't the same thing at all. So, what you want to do? Open and close a destination IP (domain), following

Re: Problem on win xp and run time error

2006-06-22 Thread Michele Petrazzo
Chris Lambacher wrote: On Sat, Jun 17, 2006 at 07:32:34AM +, Michele Petrazzo wrote: Chris Lambacher wrote: On Fri, Jun 16, 2006 at 06:11:53PM +, Michele Petrazzo wrote: Hi list, just found in this moment that my applications stop to work with win xp and receive this error

Re: Problem on win xp and run time error

2006-06-17 Thread Michele Petrazzo
Chris Lambacher wrote: On Fri, Jun 16, 2006 at 06:11:53PM +, Michele Petrazzo wrote: Hi list, just found in this moment that my applications stop to work with win xp and receive this error: This application has requested the Runtime to terminate it in an unusual way. Please contact

Re: Problem on win xp and run time error

2006-06-17 Thread Michele Petrazzo
Fredrik Lundh wrote: I see that the page says: This problem may occur when you use the /GR and the /MD compiler switches hint 1: the use of may in that sentence is intentional. This is the only, real, answer/solution that I found on internet, so I thought that was the problem. This also

Problem on win xp and run time error

2006-06-16 Thread Michele Petrazzo
Hi list, just found in this moment that my applications stop to work with win xp and receive this error: This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. (Note that the same application [python

Re: FreeImagePy and PIL

2006-06-05 Thread Michele Petrazzo
David Isaac wrote: I am just starting to think about image processing. What are the overlaps and differences in intended functionality between FreeImagePy and PIL? Thanks, Alan Isaac http://tinyurl.com/m5kal For any other questions, I'm here :) Bye, Michele --

Re: Trying to get FreeImagePy to work.

2006-06-05 Thread Michele Petrazzo
Fredrik Lundh wrote: So you *need* to invert it to work correctly with PIL! PIL has no problem reading min-is-white TIFF images. it would be nice if you stopped posting bogus support information for other libraries. Sorry if my posts make to seem that other libraries has problems! Sure

Re: Trying to get FreeImagePy to work.

2006-06-03 Thread Michele Petrazzo
Iain King wrote: I'll try out FIPY's resizing tomorrow too. OTOH, I have functions to convert between PIL and wxPython, and functions to convert betweem PIL and FIPY, but I don't see a function to convert FIPY to wxPython? Image at: http://www.snakebomb.com/misc/example.tif Iain

Re: ctypes pointers and SendMessage

2006-06-01 Thread Michele Petrazzo
Metalone wrote: I would like to call windll.user32.SendMessageA(hwnd, win32con.WM_COMMAND, wParam, lParam) where lParam represents a pointer to an object. and the others? And also convert this pointer back to an object reference inside of wnd_proc def wnd_proc(hwnd, msg, wParam,

Re: Trying to get FreeImagePy to work.

2006-06-01 Thread Michele Petrazzo
Iain King wrote: Michele Petrazzo wrote: Iain King wrote: Michele Petrazzo wrote: I downloaded and installed 0.9.9.3, and it now works. Thanks! I advice you to don't use that ctypes version... Better is to use the newest one and update freeimagepy! Iain Michele OK, Ive

Re: Trying to get FreeImagePy to work.

2006-06-01 Thread Michele Petrazzo
Iain King wrote: Can you download the last svn version from sf.net? Otherwise I'll send you the last sources privately. Bye, Michele I got the TortoiseSVN client though, and checked out your newest build, copied it over the top of site-packages/freeimagepy, updated my ctypes back to

Re: Trying to get FreeImagePy to work.

2006-05-26 Thread Michele Petrazzo
Iain King wrote: I've installed ctypes and FreeImagePy. When I do this: import FreeImagePy f = FreeImagePy.Image() I put a 'print self._name' in the ctypes __init__ file, just before line 296 - it's printing out the 'find' just before the error. So, in what specific way have I screwed

Re: Trying to get FreeImagePy to work.

2006-05-26 Thread Michele Petrazzo
Iain King wrote: Michele Petrazzo wrote: I downloaded and installed 0.9.9.3, and it now works. Thanks! I advice you to don't use that ctypes version... Better is to use the newest one and update freeimagepy! Iain Michele -- http://mail.python.org/mailman/listinfo/python-list

Re: Starting/launching eric3

2006-05-15 Thread Michele Petrazzo
Byte wrote: OK, now I've managed to get it working, but when I run it the eric3 splash screen pops up, and then it says (in terminal): [EMAIL PROTECTED]:~$ eric3 Traceback (most recent call last): File /usr/lib/site-python/eric3/eric3.py, line 147, in ? main() File

Re: Python memory deallocate

2006-05-11 Thread Michele Petrazzo
Heiko Wundram wrote: As was said before: as long as you keep a reference to an object, the object's storage _will not be_ reused by Python for any other objects (which is sensible, or would you like your object to be overwritten by other objects before you're done with them?). Besides, even

Re: python 2.5a2, gcc 4.1 and memory problems

2006-05-08 Thread Michele Petrazzo
[EMAIL PROTECTED] wrote: Michele Petrazzo wrote: I haven't tried to recompile py 2.4 myself with gcc 4.1 because it is already compiled with it (4.0.3), so I think (only think) that is a py 2.5 problem. I'm right? or I have to compile it with something other switches? Sounds like a gcc

python 2.5a2, gcc 4.1 and memory problems

2006-05-06 Thread Michele Petrazzo
Hi list, I'm doing some tests on my debian testing and I see a very strange memory problem with py 2.5a2 (just downloaded) and compiled with gcc 4.1.0, but not with the gcc 3.3.5: My test are: #--test.py import sys if sys.version.startswith(2.3): from sets import Set as set

Re: Best IDE for Python?

2006-05-06 Thread Michele Petrazzo
Saurabh Sardeshpande wrote: Pardon if this is already discussed extensively. But what is the best IDE for Python for a newbie? I have experience in C++ and Java and this is the first time I am learning a scripting language. Thanks in advance Try all the you find! However on linux I find

Re: OpenOffice UNO export PDF help needed

2006-05-01 Thread Michele Petrazzo
Sells, Fred wrote: I've geen googling for 3 days now, and cannot find out how to do this. I'm trying to use OpenOffice 2.0 and UNO to generate PDF documents. I'm using windows, but will have to make it work under Linux for production. I've been able to set the parameters and call the

Re: pytiff for windows

2006-04-27 Thread Michele Petrazzo
Iain King wrote: -cut pytiff- (or alternatively tell me how to get PIL to save a multipage tiff). PIL can't. If you need to work with multi-page images (tiff and others), you can use freeimagepy (freeimagepy.sf.net) import FreeImagePy as FIPY lst_names = (/tmp/f1.png, /tmp/f2.jpg) F =

Re: pytiff for windows

2006-04-27 Thread Michele Petrazzo
Michele Petrazzo wrote: import FreeImagePy as FIPY lst_names = (/tmp/f1.png, /tmp/f2.jpg) F = FIPY.freeimage() F.convertToMultiPage(lst_names, out.tif, FIPY.FIF_TIFF) (0, 'All ok!! File saved on out.tif') Sorry for this bad copy/paste/thunderbird :) import FreeImagePy as FIPY

Re: wxpython warnings

2006-04-26 Thread Michele Petrazzo
Philippe Martin wrote: I had a similar but simple problem (the file was missing) and had to check by hand before calling wxPython. Can you check the tag by hand before calling wxPython ? Philippe Hi, also I have the same problem with g3/g4 images. My solution was convert that image

Re: GRIB to images

2006-04-24 Thread Michele Petrazzo
Sheldon wrote: Hi, I am interesseted on reading some GRIB files using python and then converting the fields to gif images. Does anyone know if this is possible or have a program that does this? Yes of course with PIL. http://www.pythonware.com/products/pil/

Re: Python Module for Determining CPU Freq. and Memory?

2006-04-06 Thread Michele Petrazzo
Tim Golden wrote: [efrat] |I'd like to determine at runtime the computer's CPU frequency and | memory. | | (Please note: I'm interested in hardware stuff, like how much | memory the | machine has; not how much free memory is available.) I don't know if there's a cross-platform

shelve and .bak .dat .dir files

2006-04-06 Thread Michele Petrazzo
Hi, I'm trying a script on a debian 3.1 that has problems on shelve library. The same script work well on a fedora 2 and I don't know why it create this problem on debian: #extract from my code import shelve class XX: def __init__(self): self._data = shelve.open(/tmp/myfile) # do the

Re: How to work with directories and files with spaces

2006-04-06 Thread Michele Petrazzo
[EMAIL PROTECTED] wrote: hi I am working in unix and i have some directories names with spaces eg ABC DEF A how can i work effectively with spaces in directory/file names in python? Like you can do with unix: michele:~$ echo Michele my\ name michele:~$ python Python 2.3.5 (#2, May 4

Re: shelve and .bak .dat .dir files

2006-04-06 Thread Michele Petrazzo
Sion Arrowsmith wrote: This is a documented behaviour of shelve: Sorry, I had read only the: Open a persistent dictionary. The filename specified is the base filename ... :) I guess this depends on what dbm shelve is built on the documentation implies it goes through anydbm. I'm not seeing

base64 memory question

2006-03-31 Thread Michele Petrazzo
Hi ng, I see that after en encoding with base64, the memory used for the variable that I use for store the encoded data, after deleted, python keep a part of that memory: #ls -lh on /tmp/test_zero #-rw-r--r-- 1 michele michele 9,8M 2006-03-31 18:32 /tmp/test_zero michele:~$ python2.4 Python

String split

2006-03-28 Thread Michele Petrazzo
Hello ng, I don't understand why split (string split) doesn't work with the same method if I can't pass values or if I pass a whitespace value: .split() [] .split( ) [''] But into the doc I see: If sep is not specified or is None, any whitespace string is a separator. In this two cases,

Re: String split

2006-03-28 Thread Michele Petrazzo
Peter Otten wrote: The documentation for Python 2.4 has a better explanation. -cut- Quoted after http://docs.python.org/lib/string-methods.html#l2h-202. Peter Thanks, I haven't see it. Just a question about that different algorithm, because it force the developer to do other work for

Re: Exception not raised - May be the end

2006-03-03 Thread Michele Petrazzo
Sion Arrowsmith wrote: Michele Petrazzo [EMAIL PROTECTED] wrote: some days ago I posted here and say that python forgot to raise an exception, but my code was too long for make some tries possible. But now I can reproduce the problem into another, little, project: www.unipex.it/vario

Exception not raised - May be the end

2006-03-02 Thread Michele Petrazzo
Hi group, some days ago I posted here and say that python forgot to raise an exception, but my code was too long for make some tries possible. But now I can reproduce the problem into another, little, project: (Need wx 2.6) Here is the code: www.unipex.it/vario/wxFrameSchedule.py

Re: Simple System Tray Icon

2006-03-02 Thread Michele Petrazzo
3c273 wrote: Hello, I have a short looping script that runs in the background (Windows 2000) and I want to have a tray icon so I know that it is running. I have looked at wxTaskBarIcon and the examples on the web and in the demo, but it seems pretty complex and I haven't had any success even

Re: Exception not raised

2006-02-25 Thread Michele Petrazzo
Diez B. Roggisch wrote: This code are inside a method into class that have no try/except. And called from a method inside a wx.Frame derivate. The other strange thing is that if I try the same code just before the caller to that method, it raise an exception: So maybe the C-layer of wx

Exception not raised

2006-02-24 Thread Michele Petrazzo
Hi list, I have a strange error on my software on win 2k/xp and debian 3.1 with py 2.3.5 / 2.4.1 + twisted + wxpython: python, on a piece of code doesn't raise a KeyError on a dict (that don't have that key), but the strange thing is that the try/except code see that exception. Other strange

Re: Exception not raised

2006-02-24 Thread Michele Petrazzo
Diez B. Roggisch wrote: Not here: t_fields = {} #code def test(): print type(t_fields), 11 in t_fields print t_fields[11] print I'm here print ok test() print ok #end code Gives me KeyError: 11 Also on my environ when I try this 4 line code. My project, where that

Re: Exception not raised

2006-02-24 Thread Michele Petrazzo
Michele Petrazzo wrote: Hi list, I have a strange error on my software on win 2k/xp and debian 3.1 with py 2.3.5 / 2.4.1 + twisted + wxpython: Just for give evidence to my _failed_ tests, my a debugger (eric3), it see the exception, so it break with a KeyError! And the same code, no! Thanks

Re: Exception not raised

2006-02-24 Thread Michele Petrazzo
Michele Petrazzo wrote: Michele Petrazzo wrote: Hi list, I have a strange error on my software on win 2k/xp and debian 3.1 with py 2.3.5 / 2.4.1 + twisted + wxpython: Opss, I forgot some words :) Just for give evidence to my _failed_ tests, my a debugger (eric3), it with a debugger

Re: PyUNO with different Python

2006-02-23 Thread Michele Petrazzo
Stefan Behnel wrote: M�ta-MCI schrieb: The second way don't run: Traceback (most recent call last): File C:\Program Files\OpenOffice.org 2.0\program\hello_world.py, line 1, in? import uno File C:\Program Files\OpenOffice.org 2.0\program\uno.py, line 37, in ? import pyuno ImportError:

Re: PyUNO with different Python

2006-02-23 Thread Michele Petrazzo
Katja Suess wrote: Thanks. What I have in mind is to write a Python script to generate PDFs from a set of ODTs. Pay attention that you have a OOo program running somewhere that accept the connection from your zope server (I don't think that you have a X server running on it.) This script has

Re: PyUNO with different Python

2006-02-22 Thread Michele Petrazzo
� wrote: Hi! maybe somebody can give me an hint to my problem setting up PyUNO on my Mac to work with my Python not the Python delivered with OpenOffice. As said in installation instructions I've set OPENOFFICE_PATH=/usr/lib/openoffice/program export PYTHONPATH=$OPENOFFICE_PATH export

ANN: FreeImagePy 1.2.2

2006-02-16 Thread Michele Petrazzo
from 1.2.0: New convertToPil function: i = FreeImagePy.Image(myImage.ext) pil = i.convetToPil() Some bugs solved Michele Petrazzo -- http://mail.python.org/mailman/listinfo/python-list

Re: Visual Report Editor

2006-02-16 Thread Michele Petrazzo
Pawel wrote: Hello, Hi Pawel, I plan to make Visual Reporting Editior, a new product for corporate-class systems. Data will be in XML and in my application, designer should be able to make fascinating templates of reports. I will use Python and MSVS 2005 Pro. What are MSVS 2005 Pro ?

Re: ANN: FreeImagePy 1.2.2

2006-02-16 Thread Michele Petrazzo
Claudio Grondi wrote: Knowing some details about PIL and as good as no details about FreeImage, I would like in this context to become enlightened by the answer to the question, when does it make sense to use FreeImage instead of PIL? Into some little environments, like tiff with G3/G4

Re: using the Filters DLL (image filters)

2006-02-15 Thread Michele Petrazzo
Dieter Vanderelst wrote: Hello, I'm trying to access the Filters-Dll provided by the filters-project (http://filters.sourceforge.net/index.htm). Nice project :) Following the advice I got from the Python list -thank you for that-, I do this using ctypes

ANN: FreeImagePy 1.2.0

2006-01-20 Thread Michele Petrazzo
from 1.1.0: Start the port to a more pythonic interface. See Image class documentation (or the examples) A bug in *nix mode that cause a problem when getStatus are called Michele Petrazzo -- http://mail.python.org/mailman/listinfo/python-list

Re: wxPython import error

2005-10-26 Thread Michele Petrazzo
[EMAIL PROTECTED] ha scritto: I have tried several times to install wxPython on Fedora Core 2. The installation seems to go fine (from sources), but when I try to import the wx module I keep getting the following error: -cut- Any help or explanation would be greatly appreciated. For a my

Re: sort problem

2005-10-21 Thread Michele Petrazzo
Kent Johnson wrote: or learn about decorate-sort-undecorate: lst = [ ...whatever ] lst = [ x[3], i, x for i, x in enumerate(lst) ] I think that here the code must be changed (for the future): lst = [ (x[3], i, x) for i, x in enumerate(lst) ] lst.sort() lst = [ x for _, _, x in lst ] Wow,

sort problem

2005-10-20 Thread Michele Petrazzo
I have a list of lists (a grid table) that can have about 15000 - 2 rows and 10 cols, so: 1 [ [ 'aaa', 'vv', 'cc', 23, ... ], 2 [ 'aav', 'vv', 'cc', 45, ... ], ... 15000 [ 'sad', 'ad', 'es', 123, ... ], ] I need to sort this list, but I need to specify two things: the column and

Re: sort problem

2005-10-20 Thread Michele Petrazzo
Lasse Vågsæther Karlsen wrote: How about: list.sort(key=lambda x: x[3]) Does that work? Yes, on my linux-test-box it work, but I my developer pc I don't have the 2.4 yet. I think that this is a good reason for update :) Thanks, Michele --

Re: epydoc, variables and encoding

2005-10-06 Thread Michele Petrazzo
Kenneth Pronovici wrote: I found a problem on epydoc. If I specify an encoding, epydoc not find my global variables, and if I remove it, it work well. -cut- No, it's not normal, and I'm fairly sure it's a bug. -cut- Otherwise, you can try applying the following patch: -cut- Maybe

Re: python image library TIFF

2005-09-22 Thread Michele Petrazzo
bryan rasmussen wrote: Hi does anyone have any experience using the Python Image library to determine if a Tiff is in the G4 or G3 codec? PIL don't support G3/G4 encoding. You can use freeimagepy that is another python graphic package. Michele (freeimagepy developer :) ) --

epydoc, variables and encoding

2005-09-21 Thread Michele Petrazzo
I found a problem on epydoc. If I specify an encoding, epydoc not find my global variables, and if I remove it, it work well. code.py: #!/usr/bin/env python # -*- coding: utf-8 -*- MY_VAR = None class foo(object): def __init__(self, foo): Some text @param foo: Pass me what you want @type foo:

Re: Wrapper module for Linux shared lib

2005-09-16 Thread Michele Petrazzo
Ernesto wrote: What's the best resource for finding out how to write a wrapper module for a shared library file *.so* in Linux? If you have only the .so file, not the source, you can use ctypes. I work always with it without problems. Michele --

distutils problem

2005-09-16 Thread Michele Petrazzo
I create a setup script for distribute my application, but I have a problems with the exe package. When I create the package with: python setup.py win bdist_wininst and execute if after, it'll copy the data file specified by data_files directive into the

  1   2   >