Skip to content

installingpyjamasandpyjamasdesktopforwindows

auto edited this page May 1, 2012 · 6 revisions

Installing Pyjamas and Pyjamas Desktop for Windows

(article contributed by Mike Truty)

I write in with questions from time to time and I really like
Pyjamas.  I noticed some concern about getting Pyjamas running on
Windows in some posts and I wanted to verify that I got Pyjamas
running on Windows today in around 30minutes with the following
recipe.  It's really straightforward and this is Windows Vista 64-bit
SP1.  This is just a checkpoint to reinforce that Pyjamas and Pyjamas
Desktop are functional on Windows.  Big thanks to lkcl for his GREAT
work and I'm sure others as well!  Mike

Here is the short recipe:

INSTALL PYJAMAS AND DEPENDENCIES:

1. Open an Administrator command-line and do everything from there.
2. Install Python 2.6.2 for Windows.
  A. Download Python 2.6.2 for Window from:
http://www.python.org/ftp/python/2.6.2/python-2.6.2.msi
  B. Run the installer from the command line and choose all the
defaults.
  C. Mine installs to C:\Python26
3. Download Pyjamas:
You can do this via Sourceforge (Option 1) or if you're feeling daring, Git (Option 2)
Option 1:
  A. Download from http://sourceforge.net/projects/pyjamas/files/pyjamas/0.6/pyjamas-0.6...
  B. Extract.
  C. Mine installed to C:\Pyjamas\v6
  D. You may have issues if pyjamas is installed to a directory with a space in it's path.
Option 2:
  A. Install msysgit from:
http://code.google.com/p/msysgit/downloads/detail?name=Git-1.7.3.1-preview20101002.exe&can=2&q=
  B. Install TortisGit from:
http://code.google.com/p/tortoisegit/downloads/detail?name=TortoiseGit-1.5.8.0-32bit.msi&can=2&q=
  C. Create a directory C:\Pyjamas\
  D. Open an explorer window, and navigate to the C:\ drive.
  E. Right click on the Pyjamas directory and select Git Clone.
  F. Enter the URL: https://github.com/pyjs/pyjs.git
     The code will download after hitting OK
  G. After this point, wherever C:\Pyjamas\v6 replace it with C:\Pyjamas\pyjamas\
4. Install comtypes 0.6.1.
  A. Download from http://sourceforge.net/projects/comtypes/files/comtypes/0.6.1/comtype...
  B. Run installer from the command line.
  C. Mine seems to create files under C:\Python26\Lib\site-packages
\comtypes.
5. [Optional?] Install Python for Windows Extensions (pywin32) from:
http://sourceforge.net/projects/pywin32/files/pywin32/Build%20214/pyw...
  A. I'm not sure if this is even necessary anymore.

(lkcl: no, it's not)

  B. I did install it by running the installer from the command line.
  C. It does seem to add some packages/files under C:\Python26\Lib
\site-packages.

6. Permanently update the path for Python and Pyjamas.
  A. Go to System Properties.
  B. Open the advanced tab, then click on the Environmental Variables button
  C. I added the following to my path system variable: c:\python26;c:\Pyjamas
\v6\bin; (If you used Git, add c:\python26;c:\Pyjamas
\pyjamas\bin; the bin directory will be created after running bootstrap.py)
  D. Close/re-open the Admin command line.

CONFIGURE PYJAMAS AND PYTHON ON WINDOWS:

Initialize Pyjamas and create/update the bin directory:
  A. cd C:\Pyjamas\v6 (If using Git, C:\Pyjamas\pyjamas)
  B. > python bootstrap.py

I modified my bin\pyjsbuild.bat.  I'm not sure if there is a better
way to fixup PYTHONPATH.

  set _OLD_PYTHONPATH=%PYTHONPATH%
  set PYTHONPATH=c:\bin\pyjamas\v6;
  python C:\Pyjamas\v6\bin\pyjsbuild.py %CMD_LINE_ARGS%
  set PYTHONPATH=%_OLD_PYTHONPATH%

Then, I created a corresponding command for the desktop runs called
pyjd.bat:

  @echo off
  set CMD_LINE_ARGS=
  :setArgs
  if ""%1""=="""" goto doneSetArgs
  set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1
  shift
  goto setArgs
  :doneSetArgs

  set _OLD_PYTHONPATH=%PYTHONPATH%
  set PYTHONPATH=c:\bin\pyjamas\v6;
  python %CMD_LINE_ARGS%
  set PYTHONPATH=%_OLD_PYTHONPATH%

FIX PROBLEMS

(lkcl: this fix is in latest svn, it'll be in the next release)

I had to fix a problem that lkcl has already corrected. msxml2.dll is
not present on these systems however msxml3.dll is.  So, I edited
pyjamas\v6\pyjd\mshtml.py and changed
  GetModule('msxml2.dll')
to:
  GetModule('msxml3.dll')

(lkcl: likewise)

There's an issue that lkcl has already corrected that we can sidestep
easily.  This will need to be more thoroughly corrected to run
anything that uses a Timer for it's fine for these samples.  Edit
pyjamas\v6\library\pyjamas\Timer.py and delete the line with gobject
in it.


RUN EXAMPLES

Run helloworld in a browser:
  A. cd examples\helloworld
  B. I create a build.bat in sample directories:

    @echo off
    pyjsbuild.bat --print-statements Hello

  C. Run it: output\Hello.html
     NOTE: Chrome does not run files on the hard drive by default
     The hello world example won't work unless you open using the flag:
       --allow-file-access-from-files
     See: http://code.google.com/p/chromium/issues/detail?id=40787

Run helloworld from the desktop:
  A. cd examples\helloworld
  B. I create a run.bat in the sample directories:

    @echo off
    pyjd Hello.py

  C. Run it: run.bat

Run KitchenSink in a browser:
  A. cd examples\kitchensink
  B. I create a build.bat in sample directories:

    @echo off
    pyjsbuild.bat --print-statements KitchenSink

  C. Run it: output\KitchenSink.html

Run KitchenSink from the desktop:
  A. cd examples\kitchensink
  B. Create run.bat just like in helloworld but this time with
kitchensink.py.
  C. Run it: run.bat

Step back in awe and admire the work of a great community!