[Tutor] Python learning curve

TFIA Consulting, Inc. wsmith36 at comcast.net
Tue Mar 18 21:07:47 CET 2008


Hi.  I am doing some work for a company that uses Python for their application.
I have never used Python before, but I have programmed for over 35 years, maybe 12 languages including 4 assembly level.  
Your site says it should take just a "few days" to learn Python, so I told these folks to give me 12 days in case I was stupider than average.

My question is :  Who is right?  A 'few days', or going thru the docs below? (which seems a bit more complex than that).

Is this REALLY a "few days" task to learn?  Would you agree to guarantee coming up to speed in a few days @ no charge?

Thank you for your advice,
...Bill Smith

Here is their documentation on compiling :

==============================================================================
Building Miro Windows ¶
This page documents how to build Miro for Windows. We need more brave souls willing to help us conquer this platform. 

Getting started ¶
The supported Windows port of Miro is based on Mozilla XUL and found in the source:trunk/tv/platform/windows-xul directory. There's an abandoned "native" Windows port in source:trunk/tv/platform/windows don't mess with it. 

You may be able to find more information here: source:trunk/tv/platform/windows-xul/setup.py source:trunk/tv/platform/windows-xul/README 

Question : Why don't you use XUL for all platforms? ¶
Every couple of weeks someone flames us for not using XUL on all platforms. 

The XUL port of Miro is by far the most complicated and ugliest. XUL doesn't really do what we want to do well. It has a lot of "security" restrictions that we have to work around. The OS X Cocoa port is simpler, and the GTK/X11 port is by far the simplest. 

Since we have to embed all sorts of platform specific libraries, XUL's cross platformness doesn't make porting to other platforms easier. For example, embedding OS X's quicktime in XUL would be a very large project. 

>From a UI perspective, we want a native look and feel on all of our platforms, except Windows where we think the platform look sucks. A real native look and feel would require lots of tweaking for GTK, and isn't even possible on XUL/OS X. 

Compilers ¶
Visual Studio 2003 ¶
Miro makes heavy use of Python extensions. Python extensions compiled with a different compiler than Python itself are not guaranteed to work. Since the official Python distribution for Windows is compiled with Microsoft Visual C++ 7.1 (AKA Visual C++ .NET 2003), we only support the MSVC++ 7.1 family of compilers for official builds. Unfortunately, Microsoft has discontinued the no-cost "Visual C++ Toolkit 2003" compiler. 

Miro also depends on Mozilla XULRunner, PyXPCOM, VLC, and other sundries. However, building Mozilla on Win32 platforms, much less applying our patches, is such a time consuming process that we include pre-built binaries for these in source:trunk/dtv-binary-kit.
 Unless you need to debug issues with Miro's use of Mozilla code, it's recommended that you use these binaries. Currently, the binaries included are built using Mozilla 1.8 branch. 

MinGW (GCC) ¶
We've putting together instructions on building Miro with free tools. The instructions for doing this are here BuildingMiroWithMinGW. We are working hard on improving these instructions. Email us if you're interested in taking this on. If you're interested in helping but are getting stuck on compiler issues, email us, and we'll do our best to help you. Eventually, we'll merge these instructions into this document. 

Getting dependencies and setting up the build environment ¶
As of version 0.9.6, we will be using Python 2.5. The binary kit now contains XULRunner 1.8.0.4 linked against Python 2.5. 

You'll need: 

MSVC++ 7.1 (2003) compiler 
Subversion 
Either install the one from http://tortoisesvn.tigris.org/ or the one that comes with cygwin. 

The Windows binary release of Python2.5 from python.org 
I use http://www.python.org/ftp/python/2.5/python-2.5.msi 

PyRex? - http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/ 
I use http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/oldtar/Pyrex-0.9.5.1.1.tar.gz which when untarred is Pyrex-0.9.5.1a 

Untar the tarball and run python setup.py install. 

Psyco - http://psyco.sourceforge.net/ 
I run svn co -r42037 http://codespeak.net/svn/psyco/dist/ 

Be sure to run python setup.py install. 

Py2exe - http://www.py2exe.org 
I use (http://internap.dl.sourceforge.net/sourceforge/py2exe/py2exe-0.6.6.win32-py2.5.exe 

Null Soft Installer - http://nsis.sf.net/Download 
The latest sqlite3.dll file from SQLite 
I use http://www.sqlite.org/sqlitedll-3_5_2.zip 

Copy the sqlite3.dll file from the SQLite website over the one in your python directory (Usually C:\Python25\DLLs). If you forget to do this, on certain platforms your build will have this issue. http://mail.python.org/pipermail/python-list/2007-June/444281.html 

The Windows SDK 6.1 (for Vista headers) http://www.microsoft.com/downloads/details.aspx?FamilyId=E6E1C3DF-A74F-4207-8586-711EBE331CDC&displaylang=en 
Note: Make sure you use the versions of psyco and pyrex that are recommended. If you don't, you may get weird behavior. If you find other combinations that work, please let us know by listing them on this wiki or sending the working combination to the develop mailing list. 

Install all the requirements. After you do that, set up your PATH, LIB, and INCLUDE environment variables so that Python distutils can compile modules. It's important to pay attention to the order of the paths in these variables. Generally speaking, Windows compilers and tools should be first, followed by third party tools with Cygwin (if you use it) going last. 

You'll need to edit your vsvars32.bat to use the updated SDK's LIB and INCLUDE environment variables. I use the following lines. You may need to modify them to reflect the paths on your system. 

@set INCLUDE=%MSVCDir%\ATLMFC\INCLUDE;%MSVCDir%\INCLUDE;C:\Program Files\Microsoft Visual Studio 9.0\VC\Include;C:\Program Files\Microsoft SDKs\Windows\v6.1\Include;C:\Program Files\Microsoft SDKs\Windows\v6.1\Include\gl

@set LIB=%MSVCDir%\ATLMFC\LIB;%MSVCDir%\LIB;C:\Program Files\Microsoft Visual Studio 9.0\VC\Lib;C:\Program Files\Microsoft SDKs\Windows\v6.1\Lib
It's good to copy this file into your Miro directory and then add your Python and subversion directories after the @goto end or at the end of the file like this: 

@set PATH=%PATH%;C:\Program Files\subversion\bin;C:\Python25
Alternatively, you can add c:\Python25\ to the Path environment variable in Control Panel -> System -> Advanced tab -> Environment Variables. 

Execute vcvars32.bat in the DOS command prompt to pick up the build environment variables. 

Getting the prebuilt dependency kit ¶
As mentioned above, these instructions assume that you're using our prebuilt dependency kit. Simply check it out as dtv-binary-kit in the same directory where you checked out DTV and the DTV build script will find the dependency kit automatically. If you want to get the DTV source at the same time, the easiest way is to check out the entire Miro tree, including Miro, the dependency kit, and Broadcast Machine: 

svn co https://svn.participatoryculture.org/svn/dtv/trunk miro
In case your version of svn isn't validating certificates for some reason, our https certificate's fingerprint is 53:db:fa:7d:7f:41:33:cb:c3:c3:05:2b:16:0e:a8:37:60:13:07:30 

Note: As of July 28 2006, the dtv-binary and tv repositories account for 146 MB of the total 186 MB repository. 

Make sure that your path doesn't have any spaces in it. There are bugs in python's spawnl that make setup not work if you're in a directory with a space in it. 

That will create a directory named 'miro' and create tv and dtv-binary-kit (and bmachine for Broadcast Machine) as subdirectories of it. 

On the other hand, if you don't want to use the dependency kit, edit platform\windows-xul\setup.py and change the paths in the top section according to the instructions. You will still need to check out dtv-binary-kit (or browse it online), because it contains patches that will need to be applied to some of the dependencies before building. 

Building and Running ¶
To build Miro as quickly as possible and run it out of the development tree, do: This is broken as of 06-06-06. Use bdist_xul_dumb instead for now. 

python setup.py runxul
Video playback won't work. VLC doesn't know how to find its plugin directory when DTV is run this way. 

To build a self-contained, redistributable folder with an actual Miro.exe, do: 

python setup.py bdist_xul_dumb
This creates a directory dist. 

To build a single-file installer, suitable for distribution to end users: 

python setup.py bdist_xul
This will create something like dist/Miro-<version number>.exe. 

See TestingDtv for the options and environment variables supported, and information on the debugging logfile. There is no way to pass command-line options in runxul mode, other than to edit setup.py. 

Recompiling Mozilla ¶
You shouldn't have to do this unless you're debugging Mozilla specific issues. The first time, set aside a few days to figure out how to do it. 

Compile Mozilla according to the instructions found here using Mozilla 1.9. 

BuildingXULRunner has Miro specific instructions 

Recompiling Boost ¶
You shouldn't have to do this unless you're debugging Boost specific issues. 

Download the latest Boost source and the Boost jam utility http://superb-east.dl.sourceforge.net/sourceforge/boost/boost_1_33_1.tar.bz2 http://superb-west.dl.sourceforge.net/sourceforge/boost/boost-jam-3.1.13-1-ntx86.zip 
Extract bjam.exe into c:\mozilla-build\msys\local\bin\ 
Open a Mozilla build environment terminal (See BuildingXULRunner) 
Run tar xfvj boost_1_33_1.tar.bz2
cd boost_1_33_1
bjam -sTOOLS=vc-7_1 --with-python --with-python-root=C:\\mozilla-build\\python25 --with-python-version=2.5 stage
Troubleshooting ¶
Pyrex and psyco ¶
You need to have the exact versions we've listed above for psyco and Pyrex. 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080318/836fee98/attachment-0001.htm 


More information about the Tutor mailing list