My favorites | Sign in
Project Home Issues
Search
for
InstallingPyjamasAndPyjamasDesktopForWindows  

Featured
Updated Jun 27, 2010 by luke.lei...@gmail.com

Installing Pyjamas and Pyjamas Desktop for Windows

Wiki has Moved

The Pyjamas Wiki is now at http://pyjs.org/wiki

(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. Install Pyjamas 0.6.
  A. Download from http://sourceforge.net/projects/pyjamas/files/pyjamas/0.6/pyjamas-0.6...
  B. Extract.
  C. Mine installed to C:\Pyjamas\v6
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.  Based on my
reading in the group, I would skip this.

(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.

Permanently update the path for Python and Pyjamas.
  A. I added the following to my system path: c:\python26;c:\Pyjamas
\v6\bin;
  B. Close/re-open the Admin command line.

CONFIGURE PYJAMAS AND PYTHON ON WINDOWS:

Initialize Pyjamas:
  A. cd C:\Pyjamas\v6
  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:

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: this is in latest svn, it'll be in the next release)

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.

(lkcl: likewise)

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

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! 
Comment by jleigh...@gmail.com, Nov 1, 2009

There is an error in the pyjd.bat file above.

The path statement should be:

set PYTHONPATH=c:\pyjamas\v6; Not:

set PYTHONPATH=c:\bin\pyjamas\v6;

Comment by jleigh...@gmail.com, Nov 1, 2009

Does pyjamas desktop not support gears?

I tried running that sample using this process after expaning the python path to find the gears module in library/pyjamas like this:

set PYTHONPATH=c:\pyjamas\v6;c:\pyjamas\v6\library;

But I get this error:

Traceback (most recent call last):

File "GearsDemo?.py", line 1, in <module>
from pyjamas.gears import Factory
File "c:\pyjamas\v6\library\pyjamas\gears\Factory.py", line 79, in <module>
""")
File "c:\pyjamas\v6\library\pyjamas.py", line 54, in JS
ctx = main_frame.gjs_get_global_context()
AttributeError?: 'NoneType?' object has no attribute 'gjs_get_global_context'

Comment by drenna...@gmail.com, Jan 11, 2011
  1. I was able to do "easy_install comtypes" instead of downloading and installing manually
  2. "easy_install pyjamas" however failed with the following error..
  3. D:\dev\vapps>easy_install pyjamas
    Searching for pyjamas
    Reading http://pypi.python.org/simple/pyjamas/
    Reading http://pyjs.org
    Best match: pyjamas 0.7
    Downloading http://pypi.python.org/packages/source/P/Pyjamas/pyjamas-0.7.tgz#md5=8441b60bb3c88051799537852cceefd0
    Processing pyjamas-0.7.tgz
    error: Couldn't find a setup script in c:\docume~1\rennal~1.mit\locals~1\temp\easy_install-nbos5o\pyjamas-0.7.tgz
    
    D:\dev\vapps>wgethttp://pyjamas.googlecode.com/files/pyjamas-0.7.tgz
Comment by leckerke...@gmx.li, Jan 9, 2012

Sign in to add a comment
Powered by Google Project Hosting