Re: Need advice on reading contents of a file into memory

2006-03-15 Thread vinjvinj
Thanks. read() did not work when I opened the file with: f = open(someFilePath) But after changing to f = open(someFilePath, "rb") the read() works fine. VJ -- http://mail.python.org/mailman/listinfo/python-list

Need advice on reading contents of a file into memory

2006-03-15 Thread vinjvinj
f = open(someFilePath, "rb") content = [] for data in content.read() content.append(data) fullContent = "".join(content) Is there a more efficient way of doing this? I'll be running this operation on 10,000+ files where each file is an image file with size 50k-100k -- http://mail.python.org/m

Re: Performance impact of using decorators

2006-03-10 Thread vinjvinj
>>what exactly made you think that Python would be able to run your >>code *without* calling your function ? I was hoping that when the compiler finds decorators with wrapers that have the same signature it can some how "magically" combine them into one function (which gets called at run time) and

Re: Performance impact of using decorators

2006-03-10 Thread vinjvinj
>>That sounds like something for the templating engine, and _certainly_ not >>for a decorator that otherwise deals with transactions. The actual code for the page layout is in a preppy template. But the calls to the template engine are made in the startTransactrionAndBuildPage decorator >>Templat

Re: Performance impact of using decorators

2006-03-10 Thread vinjvinj
>> solution. I'm not going to tell you that decorators aren't the answer to >>all programming problems, because you already know that in your heart :- I was fearing that. The expose decorator is the only one that comes with cherrypy. The other ones are mine and are of the format: def decorator(fu

Performance impact of using decorators

2006-03-10 Thread vinjvinj
I'm building an application with cherrypy and have started using decorators quite extensively. A lot of my exposed functions look like: @expose @startTransactrionAndBuildPage @partOfTabUi(tabId) @convert(arg1=int, arg2=str) def do_main_page(self, arg1, arg2): some code I've become really fond

Re: ANN: Release of NumPy 0.9.5

2006-02-17 Thread vinjvinj
I read some of the earlier threads which essentially said that numpy is about 3-4 times slower then Numeric for smaller arrays. I'm assuming that applies only to operations that apply to the whole arrays. I was curious how the performance of the following operations would compare though: 1. Copyin

Re: ANN: Release of NumPy 0.9.5

2006-02-17 Thread vinjvinj
I use Numeric extensivly and have been thinking of migrating to Numpy. I have a couple of questions: 1. Will the speed of creating new arrays, copying new arrays and slicing new arrays be similar to Numeric? 2. I have some pyrex code that uses Numeric header files. will they be compatible with nu

Help needed with controlling the python parser

2006-01-10 Thread vinjvinj
I use python to script my application. Users will be able to write their own python scripts which are then run a grid of servers. I want to be able to capture syntax errors in submitted users scripts and then display them (with line numbers) back to the user. I also want to check for obvious thing

Re: Any wing2.0 users here?

2006-01-02 Thread vinjvinj
Here's a recent post of wingide: http://groups.google.com/group/comp.lang.python/browse_frm/thread/6be6a0a0fdbfa616/a63f11b8f63519f2?lnk=st&q=wingide+is+a+beautiful&rnum=1#a63f11b8f63519f2 I would strongly recomend it. Works great. -- http://mail.python.org/mailman/listinfo/python-list

Re: Wingide is a beautiful application

2005-12-18 Thread vinjvinj
I have the debug and the python shell just below the editor and the project and the source assistent on the right pane. You don't have to swtich tabs when you search or go to the python shell this way. The source assistant tab is always visible. Since I did not configure it in any special way, I as

Wingide is a beautiful application

2005-12-17 Thread vinjvinj
I haven't used an IDE in a long time but gave wing ide a try because I wanted the same development platform on Linux and Windows. I'm currently using Ultraedit and it works fine but needed something more portable as I'm moving my main platform over to Ubuntu. I first tried jedit and was reasonably

Re: Using python for writing models: How to run models in restricted python mode?

2005-11-09 Thread vinjvinj
Unfortunately this in not an options since all the processes share objects in memory which are about 1gig for each node. Having a copy of this in each user process is just not an options. I think I'm going to use RestrictedPython from zope3 svn which should take care of 70-80 % of the problem. --

Re: Using Which Version of Linux

2005-11-08 Thread vinjvinj
I would strongly recomend ubuntu server 5.1. I installed it on about 15 servers. Its secure out of the box. no ports are open. It comes with python 2.4.1 and a ton of python modules. The install requires only 1 cd and uses only 400 mb. -- http://mail.python.org/mailman/listinfo/python-list

Re: Using python for writing models: How to run models in restricted python mode?

2005-11-07 Thread vinjvinj
This can not be done at compile time but can be cought at execution time on linux by the following recipe: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/307871 vinjvinj -- http://mail.python.org/mailman/listinfo/python-list

Re: Using python for writing models: How to run models in restricted python mode?

2005-11-07 Thread vinjvinj
No. I was hoping to leverage the work done for restricted pythonscript by zope at: http://www.zope.org/Control_Panel/Products/PythonScripts/Help/PythonScript.py which is similar to what I want to do as well. vinjvinj -- http://mail.python.org/mailman/listinfo/python-list

Re: Using python for writing models: How to run models in restricted python mode?

2005-11-07 Thread vinjvinj
I have so many things to do to get this to production and writing a mini language would be a full project in itself. :-<. Is there an easy way to do this? If not, I'll go with the steps outlined in my other post. vinjvinj -- http://mail.python.org/mailman/listinfo/python-list

Re: Using python for writing models: How to run models in restricted python mode?

2005-11-07 Thread vinjvinj
I'm going to have write some custom performance monitoring functions to get notified when some models are running for ever and be able to terminate them. vinjvinj -- http://mail.python.org/mailman/listinfo/python-list

Re: Using python for writing models: How to run models in restricted python mode?

2005-11-07 Thread vinjvinj
While I understand 2 is very hard (if not impossible) to do in single unix process. I'm not sure why 1 would be hard to do. Since I have complete control to what code I can allow or not allow on my grid. Can i not just search for certain strings and disallow the model if it fails certain conditions

Using python for writing models: How to run models in restricted python mode?

2005-11-07 Thread vinjvinj
I have an application which allows multiple users to write models. These models get distributed on a grid of compute engines. users submit their models through a web interface. I want to 1. restrict the user from doing any file io, exec, import, eval, etc. I was thinking of writing a plugin for py