Re: why there is no pythonscript insine web browsers?
That is, why not just have a Python interpreter and some safe subset of the Python standard library run with the browser? I mean, aside It's not just the library (at a start you'd need to strip out modules os, popen, and subprocess), but you'd also need to block out exec, eval() (and by extension, input() ) from the interpreter core. Might need to do nasty things to the low-level import mechanism I'm not sure how many modules you need at all. Just being able to use Python's syntax to control the webpage and parts of the browser would be a huge win in my eyes. 2B -- http://mail.python.org/mailman/listinfo/python-list
Re: Eclipse Plugins
PyDev is open source, and the developer is pretty responsive, so if you could describe what is missing there is a good chance it would get implemented. I even fixed two bugs myself, my first ever real Java contribution... -- Heikki Toivonen I can second that. I'm a happy PyDev user myself for any Python module that is more than 100 lines long. The nice things is that it has a lot of the same keybindings as the Eclipse Java editor has (duplicating lines/blocks, organising imports, indent/dedent, etc). In cases where PyDev needs a patch the main developer is always there to help you out. 2B -- http://mail.python.org/mailman/listinfo/python-list
Re: pydev code completion problem
Confirmed (with exactly the same software). Please discuss this issue at the PyDev discussion forum: http://sourceforge.net/forum/forum.php?forum_id=293649 2B -- http://mail.python.org/mailman/listinfo/python-list
Re: PyS60
I have used PyS60 quite a lot a while ago, but what is it you exactly wanted to know? One thing I can tell you is that it's a pity that it only runs on Series 60 phones and that the security restrictions of third edition devices severely limited the options for developers. 2B -- http://mail.python.org/mailman/listinfo/python-list
Re: building a GUI
Try BoaConstructor and the wxPython library, both are wonderfull. If you don't mind using Java Swing, and there are good reasons for that, go for jython. It simplifies the java swingcode so much you don't have to use a graphical GUI builder anymore :) -- http://mail.python.org/mailman/listinfo/python-list
Re: uninstall python2.5 on debian
On Sep 18, 9:03 am, dimitri pater [EMAIL PROTECTED] wrote: Hello, both python2.3 and python2.5 are installed on my Debian webserver. For some reason, I would like to uninstall Python2.5 which was installed from source (make install) and keep 2.3. I have tried make uninstall and searched the web, but that did not help me. I guess rm -Rf python2.5 is not a wise thing to do. thanks, Dimitri -- --- You can't have everything. Where would you put it? -- Steven Wright --- please visitwww.serpia.org I'm not sure if this is what you're looking for, but in /usr/bin/ there is a symbolic link named 'python' that points to a python version in the same directory. I had the same issue and just redirected the pointer (deleted the old one and created an new one with the same name that pointed to the python version I wanted to use when invoking 'python'). Having said that, the other python version is still installed...(which was no problem at all in my case). -- http://mail.python.org/mailman/listinfo/python-list
Re: The best platform and editor for Python
There is one tool you won't be able to live without: iPython (no, it's not an Apple product, but it would be worth waiting in line for 3 days for) http://ipython.scipy.org/moin/ -- http://mail.python.org/mailman/listinfo/python-list
Re: PIL: reading bytes from Image
Thanks, I've tried the StringIO option as follows: = img = Image.open('/some/path/img.jpg') img.thumbnail((640,480)) file = StringIO, StringIO() img.save(file, 'JPEG') = But it gives me: = exceptions.TypeError Traceback (most recent call last) C:\Python24\lib\site-packages\PIL\Image.py in save(self, fp, format, **params) 1303 1304 try: - 1305 save_handler(self, fp, filename) 1306 finally: 1307 # do what we can to clean up C:\Python24\lib\site-packages\PIL\JpegImagePlugin.py in _save(im, fp, filename) 407 ) 408 -- 409 ImageFile._save(im, fp, [(jpeg, (0,0)+im.size, 0, rawmode)]) 410 411 def _save_cjpeg(im, fp, filename): C:\Python24\lib\site-packages\PIL\ImageFile.py in _save(im, fp, tile) 464 bufsize = max(MAXBLOCK, im.size[0] * 4) # see RawEncode.c 465 try: -- 466 fh = fp.fileno() 467 fp.flush() 468 except AttributeError: TypeError: descriptor 'fileno' of 'file' object needs an argument = It looks similar to the code in Sparklines except for the fact that the latter creates an Image from scratch. 2B Saving the image, in a format your client understands, to a file like object like StringIO.StringIO is an easy path to take. Sparklines shows this in action: http://bitworking.org/projects/sparklines/ max -- http://mail.python.org/mailman/listinfo/python-list
PIL: reading bytes from Image
I'm using web.py to send an image to the client. This works (shortened): print open(path, rb).read() but this doesn't: img = Image.open(path) img.thumbnail((10,10)) print img.getdata() or print img.load() How do I get the bytes of the Image object? 'getdata()' seemed the way, but unfortunately... -- http://mail.python.org/mailman/listinfo/python-list
Re: Tip: 'Open IPython here' in Windows context menu
Great! That really helps me, thanks. 2B -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython: non-GUI thread launching new frame? Delegates?
Oh boyI must have hit an all time programmers-low with this That was plain stupid. 2B You don't need the lambda - you can use: wx.CallAfter(parent.OnRequest, param) -- http://mail.python.org/mailman/listinfo/python-list
wxPython: non-GUI thread launching new frame? Delegates?
In my wxPython app a non-GUI thread (that reads info from the network) tries to open a frame to show the new info. This results in my app hanging (which is not too surprising). Coming from a C# environment I wonder if there is some sort of delegate mechanism in wxPython to do this sort of thing. 2B -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython: non-GUI thread launching new frame? Delegates?
Ah! Great tip, thanks! Now instead of calling: parent.onRequest(param) I call: wx.CallAfter(lambda x: parent.onRequest(x), param) Way cool. 2B This is rather out of date. wxPython provides a wx.CallAfter function, which will call the passed callable on the next spin through the event loop. It's essentially a wrapper around the custom event mechanism described above. Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: New Pythin user looking foe some good examples to study
http://www.daniweb.com/code/python.html http://www.pythonchallenge.com/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Best Free and Open Source Python IDE
Go for BOA if you're going to use wxPython, whose python text editor is excellent as well. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python cheatsheets
If you have a good color printer, try PQRChttp://www.limsi.fr/Individu/pointal/python/pqrc/ That is a very usefull document to use besides Richard Gruets quick ref. The only disadvantage is that it's a PDF document, pity there's no HTML version. 2B -- http://mail.python.org/mailman/listinfo/python-list
Re: nokia pys60 contacts + calendar
You can most likely find an answer on Nokia's Python forum: http://discussion.forum.nokia.com/forum/forumdisplay.php?f=102 And if there's no answer there you should post the question there :) -- http://mail.python.org/mailman/listinfo/python-list
Re: The Python Papers: Submit your Quotes
Like silence in music, whitespace is where Python Power shows The odd thing is that Python results in what I call YoYo-code. After writing some code I always discover a shorter, more elegant and more readable way of doing the same thing in Python. The same happens after adding more functionality. This goes on indefinitely, resulting in a piece of code whose length YoYo's over time Python's power is that it is fitted for both simple and complex tasks. You're not bothered with the restrictions that are only relevant when building complex systems if you just want to do something simple - Berco Beute Jack of all trades, master as well - Berco Beute -- http://mail.python.org/mailman/listinfo/python-list
Re: Progress Box or Bar in Windows
Go for wxPython, it'll fulfill all your GUI needs. Handsdown the best GUI toolkit I ever ran into. It can't get much simpler than: wx.MessageBox('hi') And there are tons of readymade dialogs and progressbars in the library. Check out the demo.py under the wxPython installation dir to see demos (and source) of the enormous list of controls. -- http://mail.python.org/mailman/listinfo/python-list
Re: Scaling pictures
cyberco wrote: PIL is certainly a fine option, but I noticed that the scaled images (scaled with the ANTIALIAS filter) are not as good as you can get with, say, Photoshop. Maybe I'm just expecting too much, but I wish I could choose a higher quality rescaling algorithm. PIL still rocks though. Sorry, I should have checked the facts a little better: you can set the quality of the compression when saving: img = Image.open('old.jpg') img.thumbnail((640,480), Image.ANTIALIAS) img.save('new.jpg', quality=95) Now PIL is definitely the way to go. :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Scaling pictures
PIL is certainly a fine option, but I noticed that the scaled images (scaled with the ANTIALIAS filter) are not as good as you can get with, say, Photoshop. Maybe I'm just expecting too much, but I wish I could choose a higher quality rescaling algorithm. PIL still rocks though. On Dec 28, 2:32 pm, Ravi Teja [EMAIL PROTECTED] wrote: Kajsa Anka wrote: I would like some advice, I'm going to build a small app that will, among other things, scale images so that they can be published on a web site. I've never done any image processing in python before so I would like to ask what is the best way of doing this, I will not do anything else than scaling the images. I found the Python Imaging Library but before I dive into that I would like to know if there is a better way of doing this.Yes. Python Imaging Library (PIL) is the preferred Python way to do this. The example is right in the documentation.http://www.pythonware.com/library/pil/handbook/image.htm from PIL import Image import glob, os size = 128, 128 for infile in glob.glob(*.jpg): file, ext = os.path.splitext(infile) im = Image.open(infile) im.thumbnail(size, Image.ANTIALIAS) im.save(file + .thumbnail, JPEG) -- http://mail.python.org/mailman/listinfo/python-list
Re: Is python for me?
One resource you should always keep at hand is this extremely useful Quick Reference: http://rgruet.free.fr/PQR24/PQR2.4.html Study it carefully, there is a lot in there that can teach you about how Python works. Fire up IPython as well and start hacking! 2B -- http://mail.python.org/mailman/listinfo/python-list
ElementTree: namespace declaration in each element?
The (excellent) ElementLibrary ads namespaces to each element when writing the tree back to a file. Say I do: tree = ET.parse('playlist.xml') snip: adding/removing elements tree.write(outFile) with the following XML: = playlist version=1 xmlns=http://xspf.org/ns/0/; trackList track titleKick off!/title /track /trackList /playlist = Writing the tree out after adding/removing elements results in: = ns0:playlist version=1 xmlns:ns0=http://xspf.org/ns/0/; ns0:trackList ns0:track ns0:titleKick off!/ns0:title /ns0:track /ns0:trackList /ns0:playlist = Unfortunately the client that needs to consume this XML can't handle the 'ns0:' part of each tag. Is there a way to output XML similar to the input? -- http://mail.python.org/mailman/listinfo/python-list
Re: ElementTree: namespace declaration in each element?
written by a it's the bytes, not the data guy, obviously ;-) hehehe...I figured it was. Wonder 'who' it was... ;) the standard serializer in 1.2 doesn't support default namespaces, so the quickest way to do this is to loop over all tags (use getiterator), strip off the {http://xspf.org/ns/0/}; prefix, add an xmlns attribute to the root (if necessary), and write it out. OK, that's what I was already doing. Thanks. Will the standard serializer in 1.3 support default namespaces? -- http://mail.python.org/mailman/listinfo/python-list
edit text in a file and save it again
I must be overlooking something here... I'm trying to edit a line in a text file. I thought this was easy with fileinput, but all examples do not write the line back to the file but simply 'print' it. I want to open the file, edit the line and save it again. Is fileinput the right module for that? -- http://mail.python.org/mailman/listinfo/python-list
Which date will it be 'over x days'?
I must be overlooking something since I can't find a simple way to calculate which date it will be over, say, 9 days. I checked the datetime, time and calendar modules, but none of them seem to have a function to calculate the time offset. -- http://mail.python.org/mailman/listinfo/python-list
OT: Search for python in Norway
Although the climate wouldn't make you think so, but searching for python is hot in Norway: http://www.google.com/trends?q=pythonctab=1geo=alldate=all I wonder what the explanation could be. Btw: Java seems to be all the rage in India :) http://www.google.com/trends?q=javactab=1geo=alldate=all -- http://mail.python.org/mailman/listinfo/python-list
Re: python about mobile game?
http://sourceforge.net/projects/pys60 -- http://mail.python.org/mailman/listinfo/python-list
Re: mod_python + apache + winxp = nogo
Thanks Jim, I indeed did not look in the mailinglist archive (you have to subscribe for that and Google didn't cache it yet). The problem was indeed the missing .DLL's. After adding them to my 'PATH' variable apache was at least able to start. Unfortunately things still don't work. When I try to load a .py file I get the error: == [Sun Apr 09 14:03:46 2006] [error] make_obcallback: could not import mod_python.apache.\n [Sun Apr 09 14:03:46 2006] [error] python_handler: no interpreter callback found. [Sun Apr 09 14:03:46 2006] [error] [client 192.168.2.100] python_handler: Can't get/create interpreter., referer: http://myserver/test/ == This seems more like a bug in mod_python. Any suggestions? -- http://mail.python.org/mailman/listinfo/python-list
Re: mod_python + apache + winxp = nogo
Hi Jim, Thanks, I'll sign up for the mailinglist, but to finish the story here: - I only have one version of Python installed - From the Python interpreter I can import the mod_python module just fine - At starup the Apache log states: [Sun Apr 09 22:16:38 2006] [notice] Apache/2.0.55 (Win32) mod_python/3.2.5b Python/2.4.2 configured -- resuming normal operations [Sun Apr 09 22:16:38 2006] [notice] mod_python: Creating 8 session mutexes based on 0 max processes and 250 max threads. Cheers, cyberco -- http://mail.python.org/mailman/listinfo/python-list
Re: mod_python + apache + winxp = nogo
yep -- http://mail.python.org/mailman/listinfo/python-list
mod_python + apache + winxp = nogo
And I thought this would be trivial...getting mod_python to run within apache on windows XP. = mod_python 3.2.8 apache 2.0.55 python2.4 winxp = After adding: LoadModule python_module modules/mod_python.so to apache's httpd.conf, apache refuses to start, saying: cannot load c:/path/mod_python.so into server: the specified module could not be found 'mod_python.so' is in the modules folder under apache, though. I've searched everywhere, but could not find a solution. Anybody here that has been successful in getting this combo to work? -- http://mail.python.org/mailman/listinfo/python-list
Import in a separate thread
I want to import a long list of modules in a separate thread to speed things up. How can I make the modules imported in that separate thread accessible outside the method? === import os # import rest in a separate thread def importRest(): import audio import socket thread.start_new_thread(importRest,()) # audio.somemethod() would fail here === -- http://mail.python.org/mailman/listinfo/python-list
Re: Import in a separate thread
Well, it is for the python implementation for Nokia Series 60 phones, and loading lots of modules in such constrained environments can certainly slow things down. The splashscreen idea is what I want to do, but that requires the loading to continue in a background thread. -- http://mail.python.org/mailman/listinfo/python-list