Now that your Pyhon program is loaded with command line arguments your boss asks you to make it exeutable (EXE).
Here are some nice things I've found:
Tutorials:
py2exe - http://www.py2exe.org/
Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts
Wednesday, September 28, 2011
getopt — Python's C-style parser for command line arguments.
Need to support command line arguments and options in your new Python program, here's what I've found:
Example code - http://www.eurion.net/python-snippets/snippet/Show%20getopt.html
Tutorial - http://www.doughellmann.com/PyMOTW/getopt/
Documentation - http://docs.python.org/library/getopt.html
Example code - http://www.eurion.net/python-snippets/snippet/Show%20getopt.html
Tutorial - http://www.doughellmann.com/PyMOTW/getopt/
Documentation - http://docs.python.org/library/getopt.html
Labels:
Documentation,
examples,
Programming,
Python,
Scripting,
Tips
Sunday, March 20, 2011
Wednesday, February 2, 2011
Iron-Python first impressions
In my previous post 'IMDb search for a given trailer', I've showed some code in Python.
I'd like to say that I'm really impressed by the easy, fast and clear code I can now manufactured with Python.
I see it as a beautiful, humanoid, cross platform, code experimental, scripting language, fast POC tool and a great development phase language.
It should be the holy grail, but....
I've compared the performance between same code in C# and Python, and not to my surprise - it's also slower, much slower, 10x times slower than a static language like C# (which is also slower compared to C++).
So, it's a 'development phase' language, where you want to deliver fast, but if we combine it with C#, like Iron-Python does, write the skeleton in python than in the 'performance phase' we move the slowest parts to C#, we have a winning combination. Almost...
'Maintenance phase'
In this phase we need a programmer familiar with python OR is willing to mess his hands with python, this can be harder to find than the horde of C# programmers.
The advantage, on the other hand, is that the code is: cleaner, more redable, less code lines ==> Easy to maintain!! ==> less time to maintain ==> Faster stable version ==> we can port the stable code to C# and have time for another coffee.
'Bug/Debug phase'
I found it very easy to debug Iron-Python, while playing it with C#-Express. But still when you put your hands in the dirt and start debuging, you can feel it's not that mature for debugging, not yet.
Still, the time i spent on curving my knowladge on python + debugging it was still less than if i had to code it in C# and debugging the same bugs.
Conclusion and personal opinion
My guts telling me - 'It's worth it'.
Go for it, but start with small projects, not important ones, not risky ones.
Try to automate monotonic stuff you do in your daily work ('Manual monitoring network drive to see if a folder changed, if it changed copy it to my personal backup folder, so i can work from home...' stuff like that...)
IMDb search for a given trailer.
This post core code...
I've started learning IronPython two weeks ago. This language is a diamond, i'm afraid i won't be able to go 'back' to .NET again :)
To summarize my study I've decided to automate something in my already overheated life.
I love movies, i can't see them all, so i see a lot of trailers.
Here is the story
Let's say you have a folder with many movie trailers that you automatically download with a daemon tool.
Let's also say that you wish to see only the trailers worth viewing, in my case: 'The score in IMDb must be above 8.0'.
Let's stop saying... here is the core code...
Code highlights / requirements
1. Given a string which contains: Trailer title keywords + superfluous keywords, extract only the title keywords.
2. Run a title search on IMDb with the title keywords.
3. From the results extract the top/first X results.
4. For each result open the title page and extract: [Title name, Year, Rating]
5. Encapsulate these results for later use.
Labels:
IMDb,
IronPython,
Movie,
Programming,
Python
Subscribe to:
Posts (Atom)