[IronPython] CreateScriptSourceFrom ... database?
dinov at microsoft.com
Mon Mar 1 22:20:30 CET 2010
Are the \r and \n getting escaped somehow? There should be no problem if the new lines are in the string the same as they would be in a file.
Your solution generally sounds like the right and easy one to go with. If you wanted a more complicated solution you could replace the PlatformAdaptionLayer class with your own which would read "files" from the database. That would enable things like "import foo" to work where the user could define a "foo" script in the database.
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Mark Grice
Sent: Monday, March 01, 2010 5:54 AM
To: users at lists.ironpython.com
Subject: [IronPython] CreateScriptSourceFrom ... database?
I have a series of Python scripts that I am running from my C# program.
I use the CreateScriptSourceFromFile() method to read in the file and execute it.
I would like, however, to move these scripts to a databse file -- simply a large memo/text field containing the full script, and then execute them from there instead of the file (to simplify my management).
I thought I could just convert the python file to a string, save it, and then bring it back with CreateScriptSourceFromString() instead. But the parser doesn't seem to like the embedded \r, \n. \t, etc.
Is there a simple way of accomplishing this that is escaping me? Has anyone ever done anything similar?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironpython-users