PEP263 (Specifying encoding) and bytecode strings

Alex Martelli aleax at aleax.it
Mon May 5 03:16:30 EDT 2003


Tony Meyer wrote:

> As per PEP 0263 [1], Python 2.3b1 gives out a depreciation warning if
> non-ascii chars are used and there isn't a specific encoding on the
> file.
> 
> Is there some way to specify that all strings are bytecodes, and not
> encoded characters?
> 
> The specific application here is resourcepackage [2].  For those not
> familiar with it, it converts non-Python files (html, jpg, whatever)
> into a Python module that can be imported and used.  The module is
> basically a zlib compressed string, and this string ends up with
> characters that the interpreter thinks are meant to be encoded chars.
> 
> TIA.
> 
> =Tony Meyer
> 
> [1] http://www.python.org/peps/pep-0263.html
> [2] http://sf.net/projects/resourcepackage

Couldn't resourcepackage just insert a suitable encoding "declaration",
which is after all a comment and thus innocuous for any previous
release of Python -- or else emit non-ascii chars as escape sequences?


Alex





More information about the Python-list mailing list