Python Language FAQ - Section 7 
Author Message
 Python Language FAQ - Section 7

This FAQ newsgroup posting has been automatically converted from an
HTML snapshot of the original python FAQ; please refer to the original
"Python FAQ Wizard" at < http://www.*-*-*.com/ ;
if source code snippets given in this document do not work - incidentally
some formatting information may have been lost during the conversion.

----------------------------------------------------------------------------

The whole Python FAQ - Section 7

Last changed on Mon Jun 28 19:36:09 1999 EDT

(Entries marked with ** were changed within the last 24 hours; entries
marked with * were changed within the last 7 days.)

----------------------------------------------------------------------------

7. Using Python on non-UNIX platforms

7.1.  Is there a Mac version of Python?
7.2.  Are there DOS and Windows versions of Python?
7.3.  Is there an OS/2 version of Python?
7.4.  Is there a VMS version of Python?
7.5.  What about IBM mainframes, or other non-UNIX platforms?
7.6.  Where are the source or Makefiles for the non-UNIX versions?
7.7.  What is the status and support for the non-UNIX versions?
7.8.  I have a PC version but it appears to be only a binary. Where's
      the library?
7.9.  Where's the documentation for the Mac or PC version?
7.10. How do I create a Python program file on the Mac or PC?
7.11. How can I use Tkinter on Windows 95/NT?
7.12. cgi.py (or other CGI programming) doesn't work sometimes on NT or
      win95!
7.13. Why doesn't os.popen() work in PythonWin on NT?
7.14. How do I use different functionality on different platforms with
      the same program?
7.15. Is there an Amiga version of Python?
7.16. Why doesn't os.popen()/win32pipe.popen() work on Win9x?

----------------------------------------------------------------------------

7. Using Python on non-UNIX platforms

----------------------------------------------------------------------------

7.1. Is there a Mac version of Python?

Yes, see the "mac" subdirectory of the distribution sites, e.g.
ftp://ftp.python.org/pub/python/mac/.

----------------------------------------------------------------------------

7.2. Are there DOS and Windows versions of Python?

Yes. The core windows binaries are available from
http://www.*-*-*.com/
available, including a large number of not-always-compatible GUI toolkits.
The core binaries include the standard Tkinter GUI extension.

Most windows extensions can be found (or referenced) at
http://www.*-*-*.com/

Windows 3.1/DOS support seems to have dropped off recently. You may need to
settle for an old version of Python one these platforms. One such port is
WPY

WPY: Ports to DOS, Windows 3.1(1), Windows 95, Windows NT and OS/2. Also
contains a GUI package that offers portability between Windows (not DOS) and
Unix, and native look and feel on both.
ftp://ftp.python.org/pub/python/wpy/.

----------------------------------------------------------------------------

7.3. Is there an OS/2 version of Python?

Yes, see the "pc" and "wpy" subdirectory of the distribution sites (see
above).

----------------------------------------------------------------------------

7.4. Is there a VMS version of Python?

Yes, there is a port of Python 1.4 to OpenVMS and a few ports of 1.2 to VMS.
See ftp://ftp.python.org/pub/python/contrib/Porting/vms/.

Uwe Zessin has ported Python 1.5.x to OpenVMS. See
http://www.*-*-*.com/ ~zessin/.

----------------------------------------------------------------------------

7.5. What about IBM mainframes, or other non-UNIX platforms?

I haven't heard about these, except I remember hearing about an OS/9 port
and a port to Vxworks (both operating systems for embedded systems). If
you're interested in any of this, go directly to the newsgroup and ask
there, you may find exactly what you need. For example, a port to MPE/iX 5.0
on HP3000 computers was just announced, see
http://www.*-*-*.com/

----------------------------------------------------------------------------

7.6. Where are the source or Makefiles for the non-UNIX versions?

The standard sources can (almost) be used. Additional sources can be found
in the platform-specific subdirectories of the distribution.

----------------------------------------------------------------------------

7.7. What is the status and support for the non-UNIX versions?

I don't have access to most of these platforms, so in general I am dependent
on material submitted by volunteers. However I strive to integrate all
changes needed to get it to compile on a particular platform back into the
standard sources, so porting of the next version to the various non-UNIX
platforms should be easy.

----------------------------------------------------------------------------

7.8. I have a PC version but it appears to be only a binary. Where's the
library?

If you are running any version of Windows, then you have the wrong
distribution. The FAQ lists current Windows versions. Notably, Pythonwin and
wpy provide fully functional installations.

But if you are sure you have the only distribution with a hope of working on
your system, then...

You still need to copy the files from the distribution directory
"python/Lib" to your system. If you don't have the full distribution, you
can get the file lib<version>.tar.gz from most ftp sites carrying Python;
this is a subset of the distribution containing just those files, e.g.
ftp://ftp.python.org/pub/python/src/lib1.4.tar.gz.

Once you have installed the library, you need to point sys.path to it.
Assuming the library is in C:\misc\python\lib, the following commands will
point your Python interpreter to it (note the doubled backslashes -- you can
also use single forward slashes instead):

            >>> import sys
            >>> sys.path.insert(0, 'C:\\misc\\python\\lib')
            >>>

For a more permanent effect, set the environment variable PYTHONPATH, as
follows (talking to a DOS prompt):

            C> SET PYTHONPATH=C:\misc\python\lib

----------------------------------------------------------------------------

7.9. Where's the documentation for the Mac or PC version?

The documentation for the Unix version also applies to the Mac and PC
versions. Where applicable, differences are indicated in the text.

----------------------------------------------------------------------------

7.10. How do I create a Python program file on the Mac or PC?

Use an external editor. On the Mac, BBEdit seems to be a popular no-frills
text editor. I work like this: start the interpreter; edit a module file
using BBedit; import and test it in the interpreter; edit again in BBedit;
then use the built-in function reload() to re-read the imported module; etc.
In the 1.4 distribution you will find a BBEdit extension that makes life a
little easier: it can tell the interpreter to execute the current window.
See :Mac:Tools:BBPy:README.

Regarding the same question for the PC, Kurt Wm. Hemr writes: "While anyone
with a pulse could certainly figure out how to do the same on MS-Windows, I
would recommend the NotGNU Emacs clone for MS-Windows. Not only can you
easily resave and "reload()" from Python after making changes, but since
WinNot auto-copies to the clipboard any text you select, you can simply
select the entire procedure (function) which you changed in WinNot, switch
to QWPython, and shift-ins to reenter the changed program unit."

If you're using Windows95 or Windows NT, you should also know about
PythonWin, which provides a GUI framework, with an mouse-driven editor, an
object browser, and a GUI-based de{*filter*}. See

            http://www.*-*-*.com/

for details.

----------------------------------------------------------------------------

7.11. How can I use Tkinter on Windows 95/NT?

Starting from Python 1.5, it's very easy -- just download and install Python
and Tcl/Tk and you're in business. See

      http://www.*-*-*.com/

One warning: don't attempt to use Tkinter from PythonWin (Mark Hammond's
IDE). Use it from the command line interface (python.exe) or the windowless
interpreter (pythonw.exe).

----------------------------------------------------------------------------

7.12. cgi.py (or other CGI programming) doesn't work sometimes on NT or
win95!

Be sure you have the latest python.exe, that you are using python.exe rather
than a GUI version of python and that you have configured the server to
execute

         "...\python.exe -u ..."

for the cgi execution. The -u (unbuffered) option on NT and win95 prevents
the interpreter from altering newlines in the standard input and output.
Without it post/multipart requests will seem to have the wrong length and
binary (eg, GIF) responses may get garbled (resulting in, eg, a "broken
image").

----------------------------------------------------------------------------

7.13. Why doesn't os.popen() work in PythonWin on NT?

The reason that os.popen() doesn't work from within PythonWin is due to a
bug in Microsoft's C Runtime Library (CRT). The CRT assumes you have a Win32
console attached to the process.

You should use the win32pipe module's popen() instead which doesn't depend
on having an attached Win32 console.

Example:

     import win32pipe
     f = win32pipe.popen('dir /c c:\\')
     print f.readlines()
     f.close()

----------------------------------------------------------------------------

7.14. How do I use different functionality on different platforms with the
same program?

Remember that Python is extremely dynamic and that you can use this dynamism
to configure a program at run-time to use available functionality on
different platforms. For example you can test the sys.platform and import
different modules based on its value.

       import sys
       if sys.platform == "win32":
          import win32pipe
          popen = win32pipe.popen
       else:
          import os
          popen = os.popen

(See FAQ 7.13 for an explanation of why you might want to do something like
this.) Also you can try to import a module and use a fallback if the import
fails:

        try:
             import really_fast_implementation
             choice = really_fast_implementation
        except ImportError:
             import slower_implementation
             choice = slower_implementation

----------------------------------------------------------------------------

7.15. Is there an Amiga version of Python?

Yes. See the AmigaPython homepage at
http://www.*-*-*.com/ ~irmen/python.html.

----------------------------------------------------------------------------

7.16. Why doesn't os.popen()/win32pipe.popen() work on Win9x?

There is a bug in Win9x that prevents os.popen/win32pipe.popen* from
working. The good news is there is a way to work around this problem. The
Microsoft Knowledge Base article that you need to lookup is: Q150956. You
will find links to the knowledge base at: http://www.*-*-*.com/

----------------------------------------------------------------------------

--
----------- comp.lang.python.announce (moderated) ----------

Python Language Home Page:   http://www.*-*-*.com/
Python Quick Help Index:     http://www.*-*-*.com/
------------------------------------------------------------



Sun, 23 Dec 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Python Language FAQ - Section 5

2. Python Language FAQ - Section 7

3. Python Language FAQ - Section 3

4. Python Language FAQ - Section 1

5. Python Language FAQ - Section 2

6. Python Language FAQ - Section 7

7. Python Language FAQ - Section 8

8. Python Language FAQ - Section 5

9. Python Language FAQ - Section 3

10. Python Language FAQ - Section 2

11. Python Language FAQ - Section 1

 

 
Powered by phpBB® Forum Software