Pickling within ASP files doesn't work

Franz GEIGER fgeiger at datec.at
Sat Jan 20 09:20:19 EST 2001


Hi all,

I'm playing around with ASP as a Python scripting host. So far I wrote a
class App which contains users among other things. Users itself is of class
Collection, which in turn wraps dictionaries. To these users I want to add
users, whose names come from form input.

So these users must be stored somehow on disk and I thougt, that pickling
the whole app object would be a good idea. But doing so I get this error:

<snip>
in save_inst save(stuff) File "c:\program files\python20\lib\pickle.py",
line 202, in save f(self, object) File "c:\program
files\python20\lib\pickle.py", line 382, in save_dict save(value) File
"c:\program files\python20\lib\pickle.py", line 162, in save raise
PicklingError, \ PicklingError: can't pickle 'PyIDispatch' object:
<PyIDispatch at 0x41be94 with obj at 0x10f5b8>

When I exec my app as a script, it works. A look into the pickle file tells
me, that pickle not only stores info about the objects pickled but also
about the module containing them. So I found the string '__main__' within
the pickle file. I guess that PyIDispatch or something like that is the
"module" when ASP executes my script and PyIDispatch (or whatever) does not
own a __str__ method.

Anyway - I'm stuck. Any hints? Are there others out there doing Pythin
within ASP?

Best regards
Franz

P.S.: It's Python 2.0. The platform is IIS4.0 on NT4.0Svr.






More information about the Python-list mailing list