I had this happening to me as well someday.
I recall that first installing it (python setup.py install), and then
rerunning selftest, solved that error.
I tried that as well.
Here is the summary of the install process:
build/temp.linux-x86_64-2.4/libImaging/ZipEncode.o -L/usr/local/lib
PIL will compile and install if you don't have some development
libraries and then simply not work or not work up to full steam when
used.
To avoid this, you need to install the appropriate libraries, among
which are:
libjpeg-devel
freetype-devel
libpng-devel
Dear Albert
Thank you for your
PIL will compile and install if you don't have some development
libraries and then simply not work or not work up to full steam when
used.
To avoid this, you need to install the appropriate libraries, among
which are:
libjpeg-devel
freetype-devel
libpng-devel
Dear Albert
Thank you
Hi there
I am having trouble to install PIL 1.1.7 on CentOS.
I read and followed the instructions from
http://effbot.org/zone/pil-imaging-not-installed.htm
However, I still get the The _imaging C module is not installed error
if I run the selftest:
$ python selftest.py
*** The _imaging C
Dear list members
I have this python list that represets a sitemap:
tree = [{'indent': 1, 'title':'Item 1', 'hassubfolder':False},
{'indent': 1, 'title':'Item 2', 'hassubfolder':False},
{'indent': 1, 'title':'Folder 1', 'hassubfolder':True},
{'indent': 2, 'title':'Sub
Use a stack?
Whenever you start a new list, push the corresponding closing tag onto
a stack. Whenever your indent level decreases, pop the stack and
write out the closing tag you get.
It's straightforward to use a python list as a stack.
Thanks for the tip, Kushal.
Do you have a short code
Hi there
I have the following list 'mylist' that contains some dictionaries:
mylist = [{'title':'the Fog', 'id':1},
{'title':'The Storm', 'id':2},
{'title':'the bible', 'id':3},
{'title':'The thunder', 'id':4}
]
How I can sort (case insensitive) the list
Er, that should have been mylist.sort(key = lambda d:
d['title'].lower()) of course.
Thanks a lot for the tip, chris.
Unfortunately, I only have Python 2.3.5 installed and can't upgrade to
2.4 due to an underliying application server.
In python 2.3 the 'sort()' function does not excepts
Thanks a lot Stefan Peter.
I'm almost there (except sorting of umlauts does not work yet).
import locale
def sorted(items, key):
decorated = [(key(item), index, item) for index, item in
enumerate(items)]
decorated.sort()
return [item[2] for item in decorated]
http://wiki.python.org/moin/HowTo/Sorting#Topicstobecovered
Works fine. Thanks a lot for your help, Stefan.
Regards
Nico
--
http://mail.python.org/mailman/listinfo/python-list
Try the timelimited function from this recipe
http://code.activestate.com/recipes/576780/
Works perfect! Thanks a lot, Jean!
--
http://mail.python.org/mailman/listinfo/python-list
Hi there,
The ftplib has a timeout parameter in Python 2.6 and above.
Is there a way to set a timeout in Python 2.4?
Regards
Nico
--
http://mail.python.org/mailman/listinfo/python-list
I don't know of one so you may need a workaround. What platforms do you
need to support?
Suse Linux Enterprise 10, 64 Bit with Python 2.4.4.
I need the Python 2.4.4 for a running application Server (Zope).
--
http://mail.python.org/mailman/listinfo/python-list
Here's a tricky case that doesn't show up in your example:
In each case above, the directory names are distinct.
how about:
['/desk', '/desk/ethanallen', '/desk/ikea',
'/desktop', /desktop/pc', '/desktop/mac']
Should the answer be ['/desk'] or ['/desk', '/desktop'] ?
Hi Scott
good point.
Dear Python developers
I have the following (sorted) list.
['/notebook',
'/notebook/mac',
'/notebook/mac/macbook',
'/notebook/mac/macbookpro',
'/notebook/pc',
'/notebook/pc/lenovo',
'/notebook/pc/hp',
'/notebook/pc/sony',
'/desktop',
'/desktop/pc/dell',
'/desktop/mac/imac',
May be not so much pythonic, but works
for i in range(len(q)):
for x in q[i:]:
if x.startswith(q[i]) and x!=q[i]:
q.remove(x)
...but works fine. Thanks, Eugene.
Also thanks to Andrew. Your example works fine, too. Thanks to remind me
of the 'yield' statement! ;-)
Hi there
I have a list of dummy objects which have the attributes 'location',
'name', 'gender'.
Now I want to rebuild this list in order to avoid redundancies on
objects with the same 'location'.
Example:
#--
class Dummy:
Hi there,
I have a string containing some hyperlinks. I'd like to replace every
hyperlink with a HTML style link.
Example:
Replace
'http://www.foo.com/any_url'
with
'a href=http://www.foo.com/any_url;http://www.foo.com/any_url/a'
What's the best way to do this if I have a few
Dear list members,
I have a Perl script which crypts a password using a clearteaxt password
and a username.
Example:
username = '[EMAIL PROTECTED]'
password = 'root'
The crypted password is: 'roK20XGbWEsSM'
The crypted password always starts with the first 2 characters of the
username
Hi there,
I wrote a short python script that sends an email using python's email
module and I am using Python 2.3.5.
The problem is, that umlauts are not displayed properly in some email
clients:
+ On a windows machine running thunderbird 1.0.2 umlauts are displayed
properly.
The email
Hi there,
on a linux machine I am running this ldapsearch from the command line:
ldapsearch -x -h myldaphost.mydomain.com \
-D CN=ldapuser,CN=Users,DC=mydomain,DC=com -w secret \
-b CN=ANYCOMPUTER,CN=Computers,DC=mydomain,DC=com
How can I do this with python-ldap?
Regards,
Nico
--
Dear list members,
I have installed Python 2.4.3. and PIL 1.1.5. on a Suse Linux 10 64 Bit
machine.
If I try
import _imagingft
I get this error:
ImportError: No module named _imagingft
Did I miss something?
On my 32 But Linux with Python 2.3.5. everything works fine.
Kind regards,
If I try
import _imagingft
I get this error:
ImportError: No module named _imagingft
Did I miss something?
Yes, I did. Somehow, there was no _imagingft.so in the PIL directory.
--
http://mail.python.org/mailman/listinfo/python-list
Dear list members,I have the binary content of an image file and it's filename.I neither know the resolution nor the dpi of the image.No I need to convert this binary content into a 72 dpi jpeg image.
Furthermore I have to resize the image so neither the width nor the height is bigger than 250
Several changes have been made to Python 2.4 and 2.5 to support
AMD64-Linux better, and not all of these changes have been
incorporated into Python 2.3, as this software is no longer
maintained.
As others have said: you should really try to use the python 2.4
that comes with the operating
Hi there,
I'd like to install Python 2.3.5. on a 64-Bit OS (Suse Linux Enterprise
Server 10) on an AMD Opteron 64-Bit machine.
I have to use Python 2.3.5.
Do I need a special source archive or can I use Python-2.3.5.tgz from
http://www.python.org/ftp/python/2.3.5/Python-2.3.5.tgz ?
Is there
is this XML, or just something that looks a little like XML ?
Unfortunately, something that looks a little XML so I can't use a XML
parser. But the HTML parser does the job.
--
http://mail.python.org/mailman/listinfo/python-list
Hi there,
in a text with no carriage returns I need to look for all occurancies of
this string:
source id=boxparameter key=path.../parameter/source
The ... can contain different values. I need to extract the string
between source id=boxparameter key=path and /parameter/source.
Example text:
Try Beautiful Soup, or if your input is simple enough, the re module.
Hi Gabriel,
I first tried HTMLParser and wrote this short script:
from HTMLParser import HTMLParser
from htmlentitydefs import entitydefs
class MyDocParser(HTMLParser):
def __init__(self):
self.paths = []
This works as long as there are no other paramter Tags in the content
that I parse.
Got it.
I forgot to handle the 'attrs' parameter in handle_starttag().
Changed it to:
def handle_starttag(self, tag, attrs):
if tag == 'parameter':
if attrs == [('key',
Hi there,
I have installed Python 2.3.5 on Suse Linux 10.
If I enter python in the shell, the Python 2.3.5 interpreter is called.
After I installed Python 2.4.3. the Python 2.4.3 interpreter is called
which is the default behaviour I guess.
which python brings me /usr/local/bin/python which
Hi there,
I would like to search for a substring in a string and get the index of
all occurances.
mystring = 'John has a really nice powerbook.'
substr = ' ' # space
I would like to get this list:
[4, 8, 10, 17, 22]
How can I do that without using for i in mystring which might be
replace console=[... by windows=[... in your setup.py
Works perfect. Thank you, Rony!
--
http://mail.python.org/mailman/listinfo/python-list
Dear Python developers,
I use a short python script in order to run an external application plus
to open a browser displaying a default page.
My Setup: Python 2.4.3. / Windows2000
# --
# Script shortcut.py
import os
import
That depends on your OS. In Windows, I believe you would have to
recompile Python from source. On Linux, you could probably just get a
package. From Debian, I know that it's python-ssl. I'm sure most the
others would have one as well.
Hi Jerry,
thank you for your reply. I use Linux and
I use datetime class in my program and now
I have two fields that have the datetime format like this
datetime.datetime(2006, 5, 24, 16, 1, 26)
How can I find out the date/time difference ( in days) of such two
fields?
Hi Lad,
you could do this:
a = datetime.datetime(2006, 5, 24,
Hi there,
I am trying to open an https site and pass a request to it in order to
simulate the submit of an HTML form on a https site that sets an
authentication cookie for a tomcat application, so the the URL I am
trying to open points to a web form provided by the tomcat webserver.
I tried
import urllib
import urllib2
the_url = https://myserver/application/login.do;
user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
headers = { 'User-Agent' : user_agent }
values = { 'username' : 'myuser', 'password' : 'mypasswd' }
data = urllib.urlencode(values)
In doing some research into Workflow apps regarding document
management, I came across Zope. Given that it's Python Based, I
figured I'd shout to the group here...
If you want to develop an application with Zope+Python from scratch,
there are a few Zope products out there that handle
Hi there,
I am looking for a way to sort a list containing dictionaries.
This is my example list:
[{'Title': 'ABC', 'from_datetime': DateTime('2006/04/25 12:45:00
GMT+2')}, {'Title': 'DEF', 'from_datetime': DateTime('2006/04/18
12:45:00 GMT+2')}, {'Title': 'GHI', 'from_datetime':
assuming that DateTime returns something that compares correctly, you can
do something like:
def sortkey(item):
return item.get(from_datetime)
data.sort(key=sortkey)
(assuming Python 2.4 or later)
Thank you very much, Frederik. Unfortunately, I can only use Python
Dear Python users,
I'd like to split a string where 'and', 'or', 'and not' occurs.
Example string:
s = 'Smith, R. OR White OR Blue, T. AND Black AND Red AND NOT Green'
I need to split s in order to get this list:
['Smith, R.', 'White', 'Blue, T.', 'Back', 'Red', 'Green']
Any idea, how I can
can anybody point me to a tutorial, howto or example code of
python-soappy...? google did not have really useful results about...
This might be helpful:
http://www-128.ibm.com/developerworks/library/ws-pyth5/
http://users.skynet.be/pascalbotte/rcx-ws-doc/python.htm
Nico
--
Hi there,
I have a string 'Michèle' that represents the firstname of a person.
What's the best way to get all possible versions of this name if I
consider to use these characters: e, è, é, ê
I'd like to have a function that returns a list of the following names
when passing 'Michèle' as
This sounds like a homework problem. You might try splitting the name
at the e's, check the length of the resulting list and do that many
nested loops.
This was my idea too but I am wondering if there are any scripts for
tasks like this.
Nico
--
Hi there,
I could not find any ping Class or Handler in python (2.3.5) to ping a
machine.
I just need to ping a machine to see if its answering. What's the best
way to do it?
Kind regards,
Nico
--
http://mail.python.org/mailman/listinfo/python-list
add
ftp.set_debuglevel(3)
so you can see what the goes on the wire (without that information, it's hard
to tell if it's a bug in the library or a glitch in your server).
/F
Hello Fredrik ,
thank you for your reply. I did a ftp.set_debuglevel(3) and ftp.nlst()
now prints:
it's not obvious how Python could translate '' to anything other
than an empty list, so it sure looks like a server issue.
(or is a problem with running in passive mode? can you test with-
out using passive mode on the same server?)
I thought using ftp.set_pasv(0) sets active mode so I
Hi there,
I am using the ftplib library to connect to a ftp server.
After I got connected, I can see a list of file in the current directory
using ftp.dir() or ftp.retrlines('LIST'). But using ftp.nlst() returns
an empty list which seems somehow strange to me. Here is, what I did:
from
Hi there,
I would like to parse a string in Python.
If the string is e.g. '[url=http://www.whatever.org][/url]' I would like
to generate this string:
'a href=http://www.whatever.org;http://www.whatever.org/a'
If the string is e.g. '[url=http://www.whatever.org]My link[/url]' I
would like to
Hi there,
on a Linux machine running Python 2.3.5. I want to create a file
'newfile' in a directory '/tmp' only if there is no file 'transfer.lock'
in '/temp'.
A cronjob creates a file 'transfer.lock' in '/temp' directory every 15
minutes while the cronjob is doing something. This job takes
Hi Sybren and Wolfram,
thank you very much for the time.sleep() tip.
My program reads like this now.
import os
import time
WINDOWS_SHARE = 'C:\\Temp'
while 'transfer.lock' in os.listdir( WINDOWS_SHARE ):
print Busy, please wait...
time.sleep(10)
f = open(WINDOWS_SHARE + '/myfile',
That all sounds very race-y to me! The cron-job and the other process
need to take the same lock, otherwise the cron-job will start 1ms
after the other process checks for transfer.lock and before it has a
chance to create newfile and there will be trouble.
Using files as locks isn't
Hi there,
I would like to open an existing file that contains some lines of text
in order to append a new line at the end of the content.
My first try was:
f = open('/tmp/myfile', 'w') #create new file for writing
f.writelines('123') #write first line
f.close()
f =
Hi there,
I would like to copy a file from one machine (machine #01) to another
(machine #02).
machine #01: Suse Linux 9.2, Samba 3, Python 2.3.5
machine #02: Windows Machine, Destination Dir: Share\temp\files\
Both machines are in one network so they can communicate each other. In
order to
This isn't really a Python question, as this problem would exist
irrespective of the language you are using.
One possibility would be to run Samba (www.smaba.org) on the Linux
machine so it offered a share to the Windows machine. Then you could
just write to a UNC path
Hello,
I want to remove all html tags from a string content except a
...xxx/a.
My script reads like this:
###
import re
content = re.sub('([^!]([^]|\n)*)', '', content)
###
It works fine. It removes all html tags from content.
Unfortunately, this also removes a ...xxx/a occurancies.
Any idea,
57 matches
Mail list logo