Hi, Thanks for this code.
I won't be working with this today. I have a lot of code that I need to upgrade to 3.1.2. If you want to merge the script into Sage use 3.1.2 and apply the patches at #2407, #4134, and #4135. My current job is to implement key administrative functionality through the month of October, so I am expected to deal with this topic and another relating to exporting many worksheets at once. Could you please explain why you have so many servers on one machine? Would you like an automated system that connects to all your running servers and merges them into one? It wouldn't matter if the servers were on the same machine. Thanks, Timothy On Wed, Sep 17, 2008 at 3:10 PM, mhampton <[EMAIL PROTECTED]> wrote: > > I've had a bunch of different sage servers on one machine, and I > wanted to consolidate my worksheets. So I wrote the script below, > which might be useful to someone else. There is probably a better way > to do this, but I don't know what it is. Comments are appreciated, > I'm sure this can be improved. I know that there has been some recent > work on notebook administration that will be in 3.1.2 or 3.1.3, so > this could be quite outdated soon. > > def worksheetcopier(source_dir, target_dir, username = 'admin'): > ''' > Imports ALL of the worksheets from one notebook directory into > another. > ''' > nb = load(target_dir + '/' + 'nb.sobj') > users = os.listdir(source_dir + '/worksheets') > users = [x for x in users if '_' not in x] > for auser in users: > w_list = os.listdir(source_dir + '/worksheets/'+auser) > w_list = [x for x in w_list if '_' not in x] > w_list = [x for x in w_list if '.' not in x] > for ws in w_list: > try: > nb.import_worksheet(source_dir + '/worksheets/'+auser+'/'+ws > +'/worksheet.txt',username) > except Exception, err: > print 'Error with user: ' + auser > print 'Error with worksheet name: ' + ws > print err > break > nb.save() > print 'all done.' > > > --M. Hampton > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sage-edu" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-edu?hl=en -~----------~----~----~----~------~----~------~--~---
