in-memory-only file object from string

2006-08-23 Thread bobrik
Hello,

how to create a file object whose contents I initialize from a string
and which is purely in memory?
I can make a workaround like this:

filecontents = "Very interesting stuff ... "
file = os.tmpfile ()
file.write (filecontents)
file.seek (0)
procedure (fileobject = file)

but this creates a file on harddisk. Instead I would like to use
something like:

filecontents = "Very interesting stuff ... "
file = stringfile (filecontents)
procedure (fileobject = file)

Is this possible somehow? I appreciate any help.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: in-memory-only file object from string

2006-08-23 Thread bobrik
> See the standard modules: StringIO and cStringIO
Thank you!

-- 
http://mail.python.org/mailman/listinfo/python-list


Truly platform-independent DB access in Python?

2006-08-28 Thread bobrik
Hello,

I am using the Python DB API for access to MySQL. But it is not
platform-independent - I need a module not included in Python by
default - python-mysql, and it uses a compiled binary _mysql.so. So it
is not platform-independent because for each web-server on different
platform, I would have to download it and extra compile it specifically
for that platform. Do you know of any Python solution for MySQL access
that is 100% platform-independent?

Thanks for any suggestions.
Boris Dušek

-- 
http://mail.python.org/mailman/listinfo/python-list