shelve object back to dictionary

2005-10-06 Thread Ryan Krauss
Is there an easy way to convert a shelved object back to a dictionary? When I save a dictionary using shelve and then load it in a later session, I have an object whose property names are the keys of the dictionary used as an input to shelve. For example, instead of user['name'] I have user.name.

interactive multi-file search and replace

2006-06-19 Thread Ryan Krauss
I need to do some searching and replacing in about 10 latex files. Does anyone have an existing script that does this on an interactive basis? I would like to show each match and ask whether or not it should be replaced. This seems like a fairly common task and I don't want to re-invent the wheel

iso creation for python backup script

2006-09-06 Thread Ryan Krauss
I would like to write a python script to backup my wife's important stuff to a CD or DVD. She is running windows. Is there an easy way to create as iso image file using python or some other way to use python to create (and burn?) a cd? I am open to other free cd backup tools that work in windows

Re: iso creation for python backup script

2006-09-06 Thread Ryan Krauss
Something like burn4free could work if there was a way to write an input script for it. I am trying to avoid manually adding different folders to the backup each time. I want a script that does it all for me. On 9/6/06, Steve Holden <[EMAIL PROTECTED]> wrote: > Ryan Krauss wrote: &g

string parsing / regexp question

2007-11-28 Thread Ryan Krauss
I need to parse the following string: $$\pmatrix{{\it x_2}\cr 0\cr 1\cr }=\pmatrix{\left({{{\it m_2}\,s^2 }\over{k}}+1\right)\,{\it x_1}-{{F}\over{k}}\cr -{{{\it m_2}\,s^2\,F }\over{k}}-F+\left({\it m_2}\,s^2\,\left({{{\it m_2}\,s^2}\over{k}}+1 \right)+{\it m_2}\,s^2\right)\,{\it x_1}\cr 1\cr }

Re: string parsing / regexp question

2007-11-28 Thread Ryan Krauss
Interesting. Thanks Paul and Tim. This looks very promising. Ryan On Nov 28, 2007 1:23 PM, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Nov 28, 11:32 am, "Ryan Krauss" <[EMAIL PROTECTED]> wrote: > > I need to parse the following string: > > > > $

Re: string parsing / regexp question

2007-11-28 Thread Ryan Krauss
On Nov 28, 2007 1:23 PM, Paul McGuire <[EMAIL PROTECTED]> wrote: > On Nov 28, 11:32 am, "Ryan Krauss" <[EMAIL PROTECTED]> wrote: > > I need to parse the following string: > > > > $$\pmatrix{{\it x_2}\cr 0\cr 1\cr }=\pmatrix{\left({{{\it m_2}\,s^2 >

parsing python code

2007-12-05 Thread Ryan Krauss
I need to parse a Python file by breaking it into blocks matching indentation levels so that function definitions, for loops, and classes are kept together as blocks. For example, if I have something like from scipy import* from pylab import* g = .6 Input_freq = 10.0 def load_data(path):

accessing a classes code

2006-04-19 Thread Ryan Krauss
I have a set of Python classes that represent elements in a structural model for vibration modeling (sort of like FEA). Some of the parameters of the model are initially unknown and I do some system identification to determine the parameters. After I determine these unknown parameters, I would li

Re: accessing a classes code

2006-04-19 Thread Ryan Krauss
I think this is a lot like I am planning to do, except that the new classes will be dynamically generated and will have new default values that I want to specify before I write them to a file. But how do I do that? Ryan On 4/19/06, Paul McGuire <[EMAIL PROTECTED]> wrote: > "Ryan K

Re: accessing a classes code

2006-04-19 Thread Ryan Krauss
modulix <[EMAIL PROTECTED]> wrote: > Ryan Krauss wrote: > > I have a set of Python classes that represent elements in a structural > > model for vibration modeling (sort of like FEA). Some of the > > parameters of the model are initially unknown and I do some system > >

Re: accessing a classes code

2006-04-19 Thread Ryan Krauss
It turns out that what I want to do can be done using the inspect module which has methods for getsourcecode among other things. Ryan On 4/19/06, bruno at modulix <[EMAIL PROTECTED]> wrote: > Ryan Krauss wrote: > (top-post corrected) > > > > On 4/19/06, bruno at modulix &

problem calling parent's __init__ method

2008-08-07 Thread Ryan Krauss
I am trying to call a parent's __init__ method from the child's: class ArbitraryBlock(InnerBlock): def __init__(self, codelist, noout=False, **kwargs): InnerBlock.__init__(self, codelist, noout=noout, **kwargs) I get this error: : unbound method __init__() must be called with InnerB

Re: problem calling parent's __init__ method

2008-08-07 Thread Ryan Krauss
Thanks to Peter and Jerry for their help. Ryan On Thu, Aug 7, 2008 at 10:36 AM, Peter Otten <[EMAIL PROTECTED]> wrote: > Ryan Krauss wrote: > >> I am trying to call a parent's __init__ method from the child's: >> >> class ArbitraryBlock(InnerBlock): >>