Can Python be run off of a CD-ROM?

B

BJ MacNevin

Hi all,

I teach middle school and am currently trying to bring some computer science
to the students. Our district has a wonderfully linked network throughout
all our schools... done via MS Windows Network. In order to protect the
network, our district's IT department does not want things installed on the
system (or at least makes it VERY difficult to get it done). SO, I am using
MSW Logo installed onto a CD-ROM... we just stick in the CD-ROMS and run it
off of them.

BUT, I am learning about Python and think it is TERRIFIC! So I wonder if I
can do the same thing... or something similar? Is there a way to install
Python on a CD-ROM, too, if we don't need it to be accessed from a command
prompt?

Thanks,
BJ MacNevin
 
A

Arthur

Hi all,
I teach middle school and am currently trying to bring some computer science
to the students. Our district has a wonderfully linked network throughout
all our schools... done via MS Windows Network. In order to protect the
network, our district's IT department does not want things installed on the
system (or at least makes it VERY difficult to get it done). SO, I am using
MSW Logo installed onto a CD-ROM... we just stick in the CD-ROMS and run it
off of them.

I would take a look at Knoppix:

http://www.knoppix.net/

Its a bootable iso image of a Gnu/Linux operating system which has recent
Python distro included. Linux being a Very Good Thing for educational use,
IMO.

Perhaps even better for your purposes is

FREEDUC
Live CD-ROM of free software for schools

http://www.ofset.org/freeduc-cd/

Knoppix based, stocked with free educational software meant for the grade
levels you are concerned with.

What I don't know if either has IDLE readily accessible. Certainly Freeduc
should, if it doesn't.

Art
 
E

Eddie Corns

BJ MacNevin said:
I teach middle school and am currently trying to bring some computer science
to the students. Our district has a wonderfully linked network throughout
all our schools... done via MS Windows Network. In order to protect the
network, our district's IT department does not want things installed on the
system (or at least makes it VERY difficult to get it done). SO, I am using
MSW Logo installed onto a CD-ROM... we just stick in the CD-ROMS and run it
off of them.
BUT, I am learning about Python and think it is TERRIFIC! So I wonder if I
can do the same thing... or something similar? Is there a way to install
Python on a CD-ROM, too, if we don't need it to be accessed from a command
prompt?

You *could* kill two birds with on CD by running a real OS (BSD or Linux) from
CD with Python built in. Just a point to consider, don't get too worked up
about it (it's a bit slow mind you).

Anyway, to answer the main question. You can create a file system with all the
Python files on it and run from there but I think the main problem is search
paths and the like. I believe you ideally need to get the relevant information
into the registry but if you're not able to I think this is problematic. So
I was wondering whether there was a howto on running Python from Windows
without it being in the registry (and for the OP how do you get it in the
registry without an install process). I have similar problems running from a
USB memory key but at least there I can write files to the same directory
where the binaries are (though it's not ideal).

Eddie
 
M

Michael Hudson

Instinct says this Should Just Work. Things to worry about are
whether Python gets uppity about not being able to write to sys.path
(shouldn't do, happens all the time on linux) and making sure Python
can find its files.

[...]
Anyway, to answer the main question. You can create a file system with all the
Python files on it and run from there but I think the main problem is search
paths and the like. I believe you ideally need to get the relevant information
into the registry but if you're not able to I think this is problematic.

I am *fairly* sure that recent Pythons do not go near the registry.
win32all stuff does, and probably has to to get COM stuff working.

Cheers,
mwh
 
?

=?ISO-8859-1?Q?Gerhard_H=E4ring?=

Eddie said:
[...] I was wondering whether there was a howto on running Python from Windows
without it being in the registry [...]

Here's the HOWTO, in one sentence:

Grab a Python directory, copy the python{major}{minor}.dll from
%SYSTEMROOT%\system32 into this Python directory.

In there, Python now runs standalone, and you can burn the whole
directory on a CD if you like.

win32 Python does have module search paths in the registry, but they
aren't required.

-- Gerhard
 
F

Fredrik Lundh

Gerhard said:
Here's the HOWTO, in one sentence:

Grab a Python directory, copy the python{major}{minor}.dll from
%SYSTEMROOT%\system32 into this Python directory.

is the part after the comma really necessary?

(all installers I've ever used or created install the core DLL in the
Python directory as well. are there installers out there that don't
do that?)

</F>
 
?

=?ISO-8859-1?Q?Gerhard_H=E4ring?=

Fredrik said:
is the part after the comma really necessary?

(all installers I've ever used or created install the core DLL in the
Python directory as well. are there installers out there that don't
do that?)

The Pythonlabs (or should it be called python-dev installer by now?) installer
doesn't do this. At least not in the Windows 2000 and XP installations I use.

-- Gerhard
 
M

Michael Hudson

Gerhard Häring said:
The Pythonlabs (or should it be called python-dev installer by now?)
installer doesn't do this. At least not in the Windows 2000 and XP
installations I use.

ISTR this is helpful for win32all.

Cheers,
mwh
 
F

Fredrik Lundh

Gerhard said:
The Pythonlabs (or should it be called python-dev installer by now?) installer
doesn't do this. At least not in the Windows 2000 and XP installations I use.

depends on the version, I suppose. the python.org installer I used on
this machine sure left a python23.dll in the c:/python23 directory.

tim? thomas?

</F>
 
E

Eddie Corns

=?ISO-8859-1?Q?Gerhard_H=E4ring?= said:
Eddie said:
[...] I was wondering whether there was a howto on running Python from Windows
without it being in the registry [...]
Here's the HOWTO, in one sentence:
Grab a Python directory, copy the python{major}{minor}.dll from
%SYSTEMROOT%\system32 into this Python directory.
In there, Python now runs standalone, and you can burn the whole
directory on a CD if you like.
win32 Python does have module search paths in the registry, but they
aren't required.

OK ta, I will try this out. A chance to play with my new CD rewriter too.

Eddie
 
?

=?ISO-8859-1?Q?Gerhard_H=E4ring?=

Fredrik said:
depends on the version, I suppose. the python.org installer I used on
this machine sure left a python23.dll in the c:/python23 directory.

I suppose the difference is between admin- and non-admin install. I always make an
admin-install.

-- Gerhard
 
T

Thomas Heller

Fredrik Lundh said:
depends on the version, I suppose. the python.org installer I used on
this machine sure left a python23.dll in the c:/python23 directory.

tim? thomas?

As Tim said, this hasn't changed yet - for admin installs it goes into
the system directory.

For 2.3 releases it will stay this way, for future releases I
don't know.

win32all is growing in a direction where it makes fewer use of the
registry than in the past, and the sandbox py2exe is already able to
create frozen com servers which work fine with python23.dll in the
executable directory, so I assume somewhere in the future Python
releases don't need dlls in the system directory anymore.

Thomas
 
P

Peter Hansen

Thomas said:
win32all is growing in a direction where it makes fewer use of the
registry than in the past, and the sandbox py2exe is already able to
create frozen com servers which work fine with python23.dll in the
executable directory, so I assume somewhere in the future Python
releases don't need dlls in the system directory anymore.

Technically, no release since at least 2.0 has required DLLs in
the system directory, but it has taken some work (growing less by
the release) to make that possible. We've used a shared network
installation of Python for each release from 2.0 on, with only
minor tweaking.

Initially we had to move the DLLs manually from the installation
machine's SYSTEM directory to the network drive. Now the non-admin
option resolves that issue.

win32all is for us the only remaining issue. We need to include
a .pth file with two or three paths in it (even though the package
installs itself under site-packages now!). We also still need to
set up a sitecustomize.py file which does imports on pythoncom and
pywintypes, or an import of win32api (for example) will fail.
I don't recall the explanation, but without first importing those
(or perhaps just one?) modules you can't import the win32 stuff,
but if they have been imported first, then it works fine.

Details/help supplied to those with troubles doing this, on request...

-Peter
 
T

Thomas Heller

Peter Hansen said:
Technically, no release since at least 2.0 has required DLLs in
the system directory, but it has taken some work (growing less by
the release) to make that possible. We've used a shared network
installation of Python for each release from 2.0 on, with only
minor tweaking.

Initially we had to move the DLLs manually from the installation
machine's SYSTEM directory to the network drive. Now the non-admin
option resolves that issue.

win32all is for us the only remaining issue. We need to include
a .pth file with two or three paths in it (even though the package
installs itself under site-packages now!). We also still need to
set up a sitecustomize.py file which does imports on pythoncom and
pywintypes, or an import of win32api (for example) will fail.

Hehe, you know that you can import modules in the .pth file itself,
don't you? 'import ...' lines are executed.
I don't recall the explanation, but without first importing those
(or perhaps just one?) modules you can't import the win32 stuff,
but if they have been imported first, then it works fine.

Because win32api.pyd links against pywintypes23.dll, but the latter is
not on the DLL load path. So it must be imported first by
pywintypes.py, which then replaces it's module dict by pywintypes23's
dict. Or something like that.

Thomas
 
C

cmkl

I've done this with Python-2.3.2-1 on Windows
with installing a 'registry free' Python on
local network. It should work with a CD-ROM
copy as well.

First step is to install Python on a machine
locally as a non-administrator. You could
change this as an option in the Python installer.
The non-admin option ensures, that all needed
DLLs are packed in the Python directory rather the
Windows system directory.
Next step are win32all, wxPython, GTK, pyGTK
and all other needed packages.

This version uses the registry, but the registry
wouldn't be readed if you set the enviroment
variables %PYTHONHOME% and %PYTHONPATH%.

If you want to use pyGTK you have to change the
PATH variable too. For some systems with old versions
of some MS DLLs you may want to ensure that the
DLLs delivered with the Python packages are loaded
at runtime. I use a variable called "PY_DEPRECATED_OS".
All MS DLLs have to be moved in a dedicated directory,
i.e. %PYTHONHOME%DLLs\MS_DLLs . (see example below)

All this enviroment tweaking could be done by startup
batch files instead of changing the enviroment on every
Windows client (except the PY_DEPRECATED_OS variable)
See the Pythonwin.bat file below. You can create startup
files for python, pythonw, idle as needed.

----- Pythonwin.bat example -------------------------------------
@echo off
setlocal

if not "x%PYTHONHOME%" == "x" goto _START
rem never overwrite PYTHONHOME, PYTHONPATH und PATH
rem if PYTHONHOME was still set in enviroment

if not "x%OS%" == "xWindows_NT" goto _WINDOWS9X
rem Windows NT and Win9x differs
set PYTHONHOME=%~dp0
goto _PYTHONPATH

:_WINDOWS9X
set PYTHONHOME=%0\..\
goto _PYTHONPATH

:_PYTHONPATH
rem PYTHONPATH for win32all
set PYTHONPATH=%PYTHONHOME%lib\site-packages\Pythonwin;%PYTHONHOME%lib\site-packages\win32;%PYTHONHOME%lib\site-packages\win32\lib

rem PATH for GTK-2.0
set PATH=%PYTHONHOME%..\GTK\2.0\bin;%PYTHONHOME%..\GTK\2.0\lib;%PATH%

rem PATH for MS DLLs
if "x%PY_DEPRECATED_OS%" == "xTRUE" set
PATH=%PYTHONHOME%DLLs\MS_DLLs;%PATH%

:_START
start %PYTHONHOME%pythonwin.exe %*
endlocal
----- Pythonwin.bat example end ---------------------------------
 
P

Peter Hansen

Thomas said:
Hehe, you know that you can import modules in the .pth file itself,
don't you? 'import ...' lines are executed.

Nope! Even better... thanks, Thomas! :)

-Peter
 
B

BJ MacNevin

Cool idea, Arthur!

I tried to download KNOPPIX last night, and to no avial. The knoppix servers
are currently restricted from allowing downloadings. DOH! I tried to find an
available mirror someplace, but had no luck.

BJ MacNevin
 
B

BJ MacNevin

WOW!
Lots of responses. Thanks everyone! I need to play around with it more. My
first attempt of just dragging the C:\python23 directory and copying the
..dll's into it did work by and large... no IDLE which is a bummer (but
understandable). So I will try some of the other options shared here.

Thanks again for all the great and helpful feedback!

BJ MacNevin
 
C

Cousin Stanley

| I tried to download KNOPPIX last night, and to no avial.
| The knoppix servers are currently restricted from allowing downloadings.
| DOH! I tried to find an available mirror someplace, but had no luck.

BJ ....

Knoppix 3.3 is available on CD from CheapBytes.Com
for $5 US ....

http://www.cheapbytes.com

I was lucky enough to download an earlier version,
and although I have a fairly fast connection,
I will order the next one pre-burned on CD ....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top