CADDIT CAD CAM CNC Software - download AutoCAD compatible design software progeCAD Alibre T-FLEX and more
CADDIT Website Knowledge Base Search:
 Getting Help


Digg This!   

Save to


PythonD 32-bit python for DOS and Windows

PythonD FAQ

Will PythonD be updated concurrently with the latest release?

No. Selected releases only will be targeted for new PythonD releases. The current ongoing focus is rather on stabilizing all modules of the current PythonD binary release to operate as conformant and bug-free as possible under DOS.

Will PythonD be updated concurrently with other third-party libraries?

No, as new releases are driven by progress made with the PythonD port itself, including but not limited to, releases of newly targeted official Python source code releases. Effort will be made to integrate the latest usable third-party libraries in working order with each release of PythonD.

Have changes been made to the source code?

Yes, but minimal. Much of the work in PythonD is orchestrating the additional libraries, as well as adapting the Python Library to DJGPP’s  “psuedo-unix” style.

Do I need special system settings to run PythonD?

Yes. You need long-filename support, DPMI and/or cwsdpmi.exe from Delorie and setting the needed system variables. See the main PythonD page.

For the help() function you need a pager like DJGPP”s ‘less” available in the ‘textutils” package.

For building additional packages, calling external commands, or really doing anything beyond ‘pure python”, it is strongly recommended to have a *complete* DJGPP installation. Distutils will not work without DJGPP and DXE3 installed on your system.

The distribution package should be uncompressed (with internal directory structure intact) directly into your DJGPP installation, if you have one. If not, you need to set %PYTHONHOME% to the dirctory in which the distribution was unzipped.

What does the startup error “'import site' failed; use -v for traceback” indicate?

´´ sets up additional module paths listed in `pth´ files that are found in the default pythonpath. Python runs this file on startup, and it is found in the lib/python2 directory. Failure to run this file means:
1. You have DJGPP but did not extract the PythonD distribution correctly under the top DJGPP directory, or,
2. You did extract PythonD correctly, but do not have DJGPP correctly configured. See
3. If you are installing PythonD without DJGPP, you still need to manually define either the PYTHONHOME or PYTHONPATH environment correctly.
4. If you are not using an appropriate LFN driver for you platform, you may have forgotten to set the 'PYTHONCASEOK' variable.
5. A platform-specific failure to run completely. If the error persists, please report it as a bug.

How can I run a DJGPP-UNIX script using ‘os.popen’ or ‘os.system’? Windows returns an error like “command not found”!

‘popen” sends commands directly to the system shell (DOS). On its own, (also cannot run shell-scripts. You need an interpreter. PythonD works best with DJGPP”s ‘bash.exe”.

Try using “spawnv” or changing your “popen” command like this:
os.popen('allegro-config --cflags', 'r') to os.popen('bash allegro-config --cflags', 'r')     ...and
os.popen('clear', 'r') to os.popen('bash -c "clear"', 'r')     ... also see `´.

Don”t forget that PythonD is itself is a script interpreter, and DJGPP bash will execute all python scripts found in its path, so long as they have:

#! python

…as the first line of the script. In that case, the .py file extension is no longer required.

How does PythonD “distutils” differ from Linux/Unix?

In PythonD, full filenames are required. For instance, if you are compiling with gcc, you must specify ‘gcc.exe” as CC on line 33(?) of distutils/config/Makefile. Please see the final function defined by ‘distutils/” (find_executable) if you need to know how distutils finds the system compiler executables. (It also helps explain why certain changes were made to ;-)

This is not really different (Linux also requires full filenames), but is a point easily forgotten on DOS systems.

Note that the Standard Python Library is installed at:
os.path.join(prefix, "lib", "python" + sys.version[:1])
(the standard declaration uses 'sys.version[:3]')
This is for dos 8.3 compatibility (one library for both LFN and non-LFN!).

Please also note that dynamic-module linking is not performed by gcc, but by dxe3gen.

How can I determine if a script is running under PythonD (multi-platform scripts)?

if ==´posix´ and sys.platform == 'ms-dos5':

“dlmodule load error: Symbol unresolved ->” ??!!?

Please note that all global symbols provided to resolve dynamic modules from the main image had to be exported individually from the source code. Now, PythonD sources export over 700 individual C tokens to DXEs that use C/C++ library calls (like “printf” or “gethostname”, whatever). But it still might be possible that your package requires a library function that has not (yet) been added to the export list.

You may resolve the needed function by linking your DXE then with an additional static library at the DXE3GEN command line. When third party libraries are needed by a DXE (like socketmodule), additional libraries may be specified with the -l option.  Do not link your DXE with either libc.a or libgcc.a. This will break PythonD IO control and return a segfault. See the DXE documentation

What could the error: bsddb.error: (14, 'Invalid argument (EINVAL)') mean when using when it is generated via the bsddb185 hashopen method?

Simply, the database you have specified as an argument is not in a format that bsd185 will recognize. Try using the 'bsddb' module instead.

How do I use local timezones with PythonD?
PythonD makes use of the TZ API provided in DJGPP. See
The TZ environment variable is set pointing to the correct zonefile, which is part of the DJGPP distribution. I.e.:
set TZ=/dev/env/DJDIR/zoneinfo/Australia/Sydney
set TZ=D:\USR\DJGPP\zoneinfo\Australia\Sydney
are legal and work, but
set TZ=D:\\USR\\DJGPP\\zoneinfo\\Australia\\Sydney
Will cause PythonD startup to delay several seconds.


What are some other known limitations of PythonD?

- Although fcntl module is present, its function is very limited. Segment locking isn´t supported at all, and O_NONBLOCK is the only fcntl mode that won´t return an error. See DJGPP libc reference.

- os.fork(), os.popen2(),  os.popen3(),  os.popen4() require a multitasking environment. As DJGPP runs in a single-tasking DOS environment, these functions are broken.

posix.startfile arg must use *double escaped* backslash ('\\\') to represent a directory, or  use '/' on XP, eg: D:\\\mydir\\\somefile.doc = D:/mydir/somefile.doc But D:\blah or D:\\blah will not work

- Multi-threaded socket scripts are untested. Non-networking threaded scripts seem to run fine.

- Socketmodule does not support asynchronous connections.

- Mouse support has been disabled in the Dislin module. passed when line 49 modified to:
if sys.platform[:3] not in ('win', 'os2') and sys.platform != 'ms-dos5':