Python 2.3b1: RuntimeError using rexec

Russell E. Owen no at spam.invalid
Tue Apr 29 14:43:31 EDT 2003


I'm trying out Python 2.3b1 and am having trouble with rexec:

[rowen:~] rowen% python
Python 2.3b1 (#1, Apr 29 2003, 10:41:11) 
[GCC 3.1 20020420 (prerelease)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
running pythonstartup.py
>>> import rexec
>>> r = rexec.RExec()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File 
"/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/rexec.py
", line 184, in __init__
    raise RuntimeError, "This code is not secure in Python 2.2 and 2.3"
RuntimeError: This code is not secure in Python 2.2 and 2.3

Any hints?

I've looked at the what's new and the standard documentation for rexec 
and it seems normal -- no hint that the module has been deprecated or 
that one needs to jump through some "yes I know it's dangerous" hoop to 
use it.

Similarly a google search for python rexec runtimeerror turned up 
nothing interesting.

I stumbled across this when testing some existing code. This code uses 
rexec to convert a string representation of a dictionary to a dictionary 
as part of reading in font preferences.

Any suggestion on how to do that without rexec would also be 
appreciated. (I was quite disappointed that "dict" didn't do it!)

Here are some sample entries from the prefs file. I can change the file 
format if necessary but it'll be a headache for existing users. The 
prefs file handles lots of things, but dictionaries are only used for 
font descriptions and are my only use for rexec:
Data Font = {'weight': 'normal', 'family': 'Helvetica', 'overstrike': 
'0', 'underline': '0', 'slant': 'roman', 'size': '12'}
Background Color = '#fcfcfc'

-- Russell




More information about the Python-list mailing list