Domain: pythonware.com
Stories and comments across the archive that link to pythonware.com.
Comments · 25
-
Python 3 packages
PIL is working on Python 3; "The current free version is PIL 1.1.7. This release supports Python 1.5.2 and newer, including 2.5 and 2.6. A version for 3.X will be released later" (source). So is Django, Turbogears, wxpython, pygtk, etc. You can vote on which major 3rd party packages you'd like to see ported.
PyQT, CherryPy, Genshi, and many others are already ported to Python 3.
-
Histogram comparisonI found comparing histograms to be very efficient. I am currently working on a project that matches similar images by a simple algorithm:
- split the three color channels
- create normalized histogram for each channel and concatenate them into one array
- for each other image histogram, calculate the inner product of the difference of the histograms. If its smaller than a given epsilon, mark the images as "similar".
This simple algorithm can be done with ~50 lines of python code using the Image and numpy modules. It's immune to rotation, scaling, and slight color manipulation or other small changes. Makes me wonder why they use pixel-by-pixel comparison.
-
Re:Oh?
At the risk of prodding a hornets' nest here
... I've come across lots of projects that look interesting but haven't been updated or need more work.
Whatever happened to this on? Lots of potential. It's got industry backing and the audience is high end users with plenty of money. Last release in 2001.
http://sourceforge.net/projects/hbaprovider/
And excuse me the heresy, but for a noob Python developer it was a major drag to get started with SOAP, mainly because all the projects appeared to be in various states of disarray and abandonment, including promising-but-needing-help (soaplib), bloated-and-convoluted (ZSI) and totally abandoned (Pythonware, SOAP.py).
Obviously all of these have a specific history, such as a superior competing project, but compared with Java it's shameful. As I love Python it was a great disappointment. *shrug*
Anyway, I'm too tired to rack my brain for more examples, but there have been plenty. -
Re:Just use php's functions?
You'd probably be a LOT better off it you used Python and the Python Imaging Library, instead of trying to noodle around with combining PHP/Perl/ImageMagick.
First of all, PIL can solve your imaging problem, but more importantly, Python can solve your PHP problem. And then you won't have to get yourself hooked on a Perl problem as well.
There is of course an ImageMagick module for Python. But I prefer to use PIL, which is full featured, well integrated with Python, robust and efficient, and plays nicely will with Numerical Python.
-Don
-
ImageMagick is good stuff.
Imagemagick is good stuff, ive used it for a while now. Although I didn't buy a book to learn how, i just went here, for some great samples of uses:
http://www.cit.gu.edu.au/~anthony/graphics/imagick 6/
PIL isn't too shabby either http://www.pythonware.com/library/pil/handbook/ind ex.htm
Powerful stuff, maybe the book is not that great i don't know, but imagemagick and PIL are! -
Re:Perl's place in todays world?
The cheeseshop is currently the closest thing python has to CPAN. Only ~900 modules compared to CPAN's 8,000+, so it still has a way to go. There is also the Vaults of Parnassus.
Also, the daily python url is a great way to keep up with the latest developments in the Python world.
-
Python + Win32 + PIL
(1) Get over Macs. They're really not that great. For people who do work on their computer, applications are more important than the OS.
(2) Use Python with the Win32 extensions if you have to do anything special.
(3) Use the Python Image Library (PIL) for the graphics manipulation.
(4) Use wxPython for the user interface.
If you're careful you can make a platform-neutral solution that will work on Macs, Linux and Windows. So you can use your precious little brain filled with zelotry and illogical xenophobia to work on a Macs then deploy to Windows. -
Re:Python?In batch processing like this Pythons speed is extremely unlikely to be an issue. Use PIL or ImageMagik for the image processing.
And if you provide a GUI, for gods sake don't do it with Tkinter, or anything that builds on top of it. It's like stabbing yourself in the balls. Use wxPython, or PythonCard, or Wax, or (if you can pay the license fees) PyQt. Not Tkinter. Ever.
-
Don't Fall For Premature OptimizationsI almost never have problems with performance in Python, and I program in it exclusively. For those things where performance really matters -- e.g., image processing -- there are library written in C that are available from Python (and fairly easy to use) like PIL. There are lots of algorithms in Python itself that are extremely fast, like a great hashtable implementation (Python dictionaries) and sort algorithm.
If it's really a problem, there are a myriad of solutions -- Numeric and numarray for lots of numbers, psyco for JIT optimizations, Pyrex for a Python-like syntax that compiles to C (and can be as fast as C if you use it correctly), and lots of other new options as well -- IronPython is supposed to be faster than CPython (the standard implementation), there's quite a bit of work on type inference, PyPy is working hard at compiling Python to fast C, Boost can inline C++ code... there's a huge number of options.
I've never encountered someone who had to throw a project away because of performance issues in Python. Sometimes they have to change the design, move some small parts of C, make better use of other people's libraries, and always of course driven by profiling -- but that's the kind of refactoring that always happens in development. And for a very large number of applications it simply is never a problem.
-
Re:Advantages?
PIL - Python Imaging Library
http://www.pythonware.com/products/pil/ -
A few optionsKomodo
Wing IDE
Now, you mention you had trouble with boa. You're going to want to get it working unless you want to spend some money, because for $0.00 that's as good as it's going to get. Otherwise the two above are good investments. IIRC Komodo has a free version, but I'm not sure. PythonWorks had great potential but it's not being developed any more. It only supported Tkinter anyway.
That's as far as GUI designer support. If you're not having any luck you might want to try wxWorkshop. I've heard some people have luck embedding their dialogs in C++ libraries and binding them to Python programs. YMMV.
If all you want is a good Python editor with debugger support there are a bunch of them out there:
http://drpython.sourceforge.net
http://pype.sourceforge.net/ (more mature)
Personally the best Python-specialized editor I've used is IDLE, though it has no GUI capabilities. IDLE ships with the full Python distribution for Linux and Windows, and it behaves essentially the same in both platforms.
You might also want to check this article out. And of course, the clearing house.
-
Python ResourcesPython is an ideal language for hacking in - I completely agree with your points about it being easy to pick up - and easy to pick up your own code again after a month or two away from it. Here's a handy list that I have prepared for whenever somebody mentions Python in a context like this one:
Python Resources
This is a list of what I consider to be the most useful Python packages. They give Python the ability to tackle almost any project.
Core packages- Python - Get the Python interpreter, base libraries from here. The default install includes the IDLE editor.
- Win32All - Windows extensions package that includes the excellent Pythonwin editor.
- wxPython - Wrapper to the cross-platform wxWindows window manager library. It's a better windowing system than the TCL/TK library that is the default Python install.
- Boa Constructor - GUI builder that uses the wxWindows library.
- Psyco - x86 runtime compiler. Transparently improves the performance of most Python code - for performance-critical apps, it's often a much better solution than a C rewrite.
- Py2Exe - Builds Python scripts into Windows executables. Perfect for distributing programs to systems that do not have Python installed. Use with Psyco for the best effect.
- PyOpenGL - Use OpenGL from within Python
- Python Image Library (PIL) - Package for easy image loading and manipulation
- PostGreSQL - Full-function SQL database. More complete and advanced than MySQL.
- PyGreSQL - Python bindings for the PostGreSQL database.
Python includes a full suite of functionality to build internet applications in the core install, but the following are frameworks for building and deploying web applications. -
Re:Python and data typesYou're already proposing several solutions, as others are as well -- SDL (probably most accessible through PyGame), PIL, Numeric, some extensions available through SciPy, and eventually moving into things like PyTables or even lower-level functionality like array or ctypes, there's also the possibility of coding in C or another compiled language, or using Pyrex. for some easy-Python-integration goodness, or Psyco which can do some pretty magic stuff in select situations.
No, it's not like MATLAB -- Python is a general-purpose language. If you want MATLAB, then you're looking for a more specialized environment, like SciPy (maybe using iPython to provide a nice interactive environment). As a MATLAB replacement, Python is probably a work in progress.
If you want homogeneous collections with fast transformations, you must do it with somewhat opaque containers like Numeric, where anything that runs inside the inner loops of transformations is written in a very fast language. (Oh, I just remembered Weave) This is true in Lisp as well, though Lisp has also had compiled forms which are pretty quick.
Anyway, lots of options. Stop complaining and enjoy what you got!
So, is Java really better? I honestly don't know the scientific or image processing domain, so I don't know where Java's at there.
-
Python Resources.This is a list of what I consider to be the most useful Python packages. They give Python the ability to tackle almost any project.
- Python - Get the Python interpreter, base libraries from here. The default install includes the IDLE editor.
- Win32All - Windows extensions package that includes the excellent Pythonwin editor.
- wxPython - Wrapper to the cross-platform wxWindows window manager library. It's a better windowing system than the TCL/TK library that is the default Python install.
- Boa Constructor - GUI builder that uses the wxWindows library.
- Psyco - x86 runtime compiler. Transparently improves the performance of most Python code - for performance-critical apps, it's often a much better solution than a C rewrite.
- Py2Exe - Builds Python scripts into Windows executables. Perfect for distributing programs to systems that do not have Python installed. Use with Psyco for the best effect.
- PyOpenGL - Use OpenGL from within Python
- Python Image Library (PIL) - Package for easy image loading and manipulation
- Plone - Web applications, built on top of the Zope framework.
Abandon Perl! Python is the future! -
PIL
For those of you who use python, you might want to check out the Python Imaging Library, or PIL for short.
After using many, many different tools for this type of thing (including IM, netPBM, GD, and my own tools), PIL has by far become my favorite for image processing.
Check out this simple tutorial for some examples of what you can do. -
PIL
For those of you who use python, you might want to check out the Python Imaging Library, or PIL for short.
After using many, many different tools for this type of thing (including IM, netPBM, GD, and my own tools), PIL has by far become my favorite for image processing.
Check out this simple tutorial for some examples of what you can do. -
Re:Thats spin.
Except that your model does not permit for the exchange of their information prior to the full payment for their design. As a consumer you are not permitted to know anything about their design, until they have been sufficiently compensated. You haven't shown that this model is superior.
The information as a service model is better for consumers and it is proven. Check Linux vs Windows
1. Demonstrate that "Linux vs Windows" is an example of the aforementioned scenario.
2. Show that if "Linux vs Windows" is an example, that any and/or all results are applicable to all assets in an information economy.
3. As you imply for your statement to be considered a response to the aforementioned claim for proof, and imply that such proof is existent, demonstrate a proof of the economic superiority of the aforementioned model of distribution.
Linux has advanced this quickly
Linux has been in development for almost twelve years, and many parts of its userland even longer. because information has been shared between competiting companies, Redhat, Suse, and others.
Companies that also have proprietary sources of revenue.
You didn't mention some of the other names, though, that have contributed code, money, or expansive technical information like Intel, IBM, Compaq, HP, CMI, and more. Companies that have no qualms with, or outright desire to make a commodity of operating systems, or the software market altogether. Companies that rely extensively on intellectual property protections for their own sources of income. Do you see Intel or IBM calling for the removal of intellectual property protections, citing a better economic result as their motivation? Do you even see RedHat doing that?
Redhat is profiting
I really hope you can do better than this, although I would be entirely interested in an explanation as to why you believe that this is evidence demonstrating the benefits of removing intellectual property protection.
And while I think your childish obsession with comparing Windows and Linux as a means of determining the success of such a model is more than a little cliche and incredibly useless, you can always take a look at how big a failure Microsoft is in comparison to RedHat. If you could even relate RedHat to your ideology, which is rather suspect at the least, you would probably do better to find a better example.
and other companies are trying to profit
Would that be more like MandrakeSoft, or more like VA Linux Systems/VA Software?
programmers are paid to produce code, not to sell it.
The number of programmers responsible for selling, rather than producing code, is anecdotally small. Intellectual property protections are most often used in either scenario.
This does benefit the user because we get better software
Do we? This certainly seems subjective to me. It hardly matters, however. It also doesn't lend any support to your ideology.
the wheel isnt constantly reinvented
The is constantly reinvented, on this planet where is your -
Better review of the same bookCameron Laird: Book review: Python in a Nutshell "Cameron Laird reviews Alex Martelli's 'Python in a Nutshell' for UnixReview.com. Experienced, erudite author. Compelling topic. Proven format. What happens when you combine them? It depends. In book publishing, as with rock-and-roll bands and athletic teams, there are plenty of cases where apparent 'all-star' combinations have turned out badly. The fate of 'Python in a Nutshell' is happier, though. If you want to learn about Python, and can choose only one book to do so, take 'Python in a Nutshell'."
Lifted whole cloth from Daily Python-URL
-
try python
and the PIL module
you can even do it interactively
python is cross platform too so your scripts won't be wasted if/wehn you move platforms
I use it for generating thumbnails and <img> tags and whatever -
Re:This is purely logical
from the PythonWare README file for soaplib.py:
This is version 0.8 of soaplib.py. This is an experimental version,
and it has not been fully tested for interoperability. It appears to
work with Userland's implementations, and we're planning to test it
against IBM's Java implementation shortly. It is not likely to work
with Microsoft's current SOAP toolkit.
and more damning:
At this time, all public servers I've located require either HTTP/1.1 or Unicode support. This means that the current version of soaplib.py doesn't work properly with these servers.
The sample call in the soaplib.py file shows how to make a valid RPC call to a method in a given namespace. If you run that code, it'll generate a valid request, but it fails to properly parse the reply from that specific server.
not to knock the PythonWare folks -- i'm waiting with great anticipation for the next release -- but the tech isn't there yet for python. :( -
Re:This is purely logical
I personally am more interested in using XML-RPC with Zope, but the fine folks at PythonWare have a sample implementation of the Soap 1.1 protocol (or so they claim). Take a look at it here
-
It's nice, but not good enough for Python
The problem with products like Komodo, WingIDE and PythonWorks is that they offer little more features than Python's own IDLE and Pythonwin (win32). In their latest incarnation the latter also offer syntax colouring, primitive autocompletion, reasonable debugging; and some other gloss associated with modern IDE's. Not advanced, but good enough for a quick hack.
A combination of any good editor and a form-painter for a good multi-platform "GUI Library" like wxWindows or QT, easily defeats the aforementioned commercial products on a feature by feature basis. PythonWorks does incorporate a lay-out editor for tkinter, but it's limited and tkinter is hardly as slick as QT.
What Python needs IMHO is a tool like Delphi or JBuilder. Python is an ideal language for a rapid prototyping tool and fast enough for most applications. Boa Constructor is a nice attempt at creating such an IDE, but currently far too unstable for actual use.
It would be nice to have a Python plug-in for Kylix...
-
Re: Yes, you don't have to use LZW to make GIFs
Correct. For example, Fredrik Lundh's Python Imaging Library can output GIFs (along with a bunch of other formats), but the GIFs are really large because the image data isn't compressed. Apparently at one point he contacted Unisys to ask if he could get a licence for the patent, but Unisys wanted a per-sales fee and reacted uncomprehendingly to the words "free software". If, as another poster claims, Unisys is now accepting a one-time fee for unlimited use, then at least that's a baby step in the right direction.
-
Re:What about Zope?Zope is a cool system, because it's highly flexible, and you benefit from the variety of available extensions for Python; you can use things like PIL, LDAP modules, whatever, etc. (This is why it's often a good idea to use a general programming language for tasks instead of inventing a little language that gets clumsily extended.) If you're going to have multiple users maintain different chunks of a Web site, Zope's management screens provide much of the infrastructure that you need.
The downside at the moment is that, because Zope's fore-runner was an internal product used by Digital Creations, the DC people didn't have a lot of documentation for it. They've been working on getting more docs written, but the picture is still somewhat scattered. If you end up reading the source code, it would be difficult for a Python newbie because the code so full of cutting-edge technique. Luckily, you can do a lot without having to dive into the source code; it only matters for more complicated things like writing a new product or DTML tag for it.
While you're at it, check out Squishdot, which is still in really early alpha; it'll be astoundingly cool when it's finished.
-
Beware of Tcl! Use Python instead.
Python/Tk (called Tkinter) makes for a nice combination. You get Tk with the benefit of an OO language with real dynamic typing. Unfortunately it's no faster than Tcl/Tk. Here's a nice intro.
If your UI does not need to be crossplatform, pygtk may be a an even better choice. It has more widgets, is fast, and you can also write GNOME apps with the companion pygnome modules. (The pygnome package includes pygtk.)