Re: list problem

2006-07-26 Thread zutesmog

placid wrote:
> Hi all,
>
> I have two lists that contain strings in the form string + number for
> example
>
> >>> list1 = [ ' XXX1', 'XXX2', 'XXX3', 'XXX5']
>
> the second list contains strings that are identical to the first list,
> so lets say the second list contains the following
>
> >>> list1 = [ ' XXX1', 'XXX2', 'XXX3', 'XXX6']
>
> and now what ive been trying to do is find the first string that is
> available,
> i.e a string that is in neither of the two lists so the following code
> should only print XXX4 then return.
>
> for i in xrange(1,10):
> numpart = str(1) + str("%04i" %i)
> str = "XXX" + numpart
>
>   for list1_elm in list1:
>   if list1_elm == str:
>break
>   else:
>for list2_elm in list2:
>if list2_elm == str:
>   break
>else:
>   print str
>   return
>
> Cheer

Just a thought

I would probably use sets and see if the value that you are looking for
using the
union of the two lists. (Yes it won't scale to really big lists)
for instance if you do the following
set1 = set(list1)
set2 = set(list2)


you can then do a single check

if "XXX%d" % i not in set1.union(set2):  # or set1 | set2
 # do something

Rgds

Tim

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


Re: Desktop Notification/Alerts In Python

2006-08-28 Thread zutesmog

Chaos wrote:
> I am looking for ways to have a Desktop Alert, like the one most IM
> Messengers have (MSN, AIM) at the lower right above the taskbar. Can
> anyone point me to the right resources to use?

I am not sure exactly what you are looking for but
I assume you are using windows, so I would suggest you make sure you
have Mark Hammonds win32all
(http://www.python.net/crew/mhammond/win32/) installed
and have a look at the demos there.

T

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


Re: Problems installing Python Imaging Library

2008-03-12 Thread zutesmog
On Mar 10, 3:06 am, Nick Day <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to install PIL from source on my CentOS 4.5 server. The
> build summary reports that I have everything installed...
>
> 
> PIL 1.1.6 BUILD SUMMARY
> 
> version   1.1.6
> platform  linux2 2.3.4 (#1, Dec 11 2007, 05:28:55)
>   [GCC 3.4.6 20060404 (Red Hat 3.4.6-9)]
> 
> --- TKINTER support ok
> --- JPEG support ok
> --- ZLIB (PNG/ZIP) support ok
> --- FREETYPE2 support ok
>
> ... but if I try and build it I receive the following error:
>
> /usr/bin/ld: /usr/local/lib/libjpeg.a(jcparam.o): relocation
> R_X86_64_32 against `a local symbol' can not be used when making a
> shared object; recompile with -fPIC
>
> How do I fix this?  I am currently running "python setup.py build" and
> don't understand how I would change the compiling options to add the "-
> fPIC" flag.  I'm quite a newbie when it comes to Linux/Python so any
> help you could give me would be great.
>
> Thanks,
> Nick

You should be linking against a dynamic version of libjpeg rather than
the static version.  ie libjpeg.so   Looks like you have locally
installed libjpeg but only built a static version.

Rgds

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