python

Is code interpreted at every call in Web2Py ?

If so, What is the advantage ? (sure it will avoid restarting webserver). But isn't it a perfomance bottleneck? For production, is it possible to make web2py run directly from bytecode skipping interpreting stage (Caching) (except for the first request) ? ...

how to go to the next page using django paginator?

I have something like this: myobj = paginator_method(request, myresult) return render_to_response(' ', myobj, context) And when I am going to page 2 and onward its giving MultiValueDictKeyError: Key 'name' not found in <QueryDict: {u'page': [u'2']} ...

What are differences between List, Dictionary and Tuple in Python?

What is the difference between list, dictionary and tuple in Python exactly? ...

python script to Post a file from local

Can u please help me in python snippet to send a file over http using POST method. My file is in local drive. Thanks Anand ...

SWIG - running python code upon import

I have a C++ module that I'm wrapping with SWIG that uses dynamic linking. Because of the way that python deals with scope of imported functions I've had to run the command dl.open(library, dl.RLTD_NOW, dl.RTLD_GLOBAL) directly after import. This is to make sure that the C++ libraries functions are available to the other libraries that i...

Are numpy's math functions faster than python's?

hi, i have a function defined by a combination of basic math functions (abs, cosh, sinh, exp ...) I was wondering if it makes a difference (in speed) to use, for example: numpy.abs() instead of abs()? ...

Nicest, efficient way to get result tuple of sequence items fullfilling and not fullfilling condition

(This is professional best practise/ pattern interest, not home work request) INPUT: any unordered sequence or generator items, function myfilter(item) returns True if filter condition is fulfilled OUTPUT: (filter_true, filter_false) tuple of sequences of original type which contain the elements partitioned according to filter in origi...

Which webserver I should use for a pylons website?

I'm building a website with pylons. When I develop it, I use paster serve to start the built-in web server. But now, I want to publish it to a standalone server, which web server I should use? I hope it robust and has hign performance. ...

Django - Ajax HttpResponse delay

I have a django view function that calls another function if a condition is true, the function is called as a separate process, the view returns a status variable which shows if the function was called or not, the status is returned to a ajax click event assigned to a button. The problem is that when the function 'do_work' is executed aj...

How to understand makefiles and python

I'm trying to understand how a makefile works for compiling some .ui files to .py (PyQt -> Python). This is the makefile that I am using that was autogenerated: # Makefile for a PyQGIS plugin UI_FILES = Ui_UrbanAnalysis.py RESOURCE_FILES = resources.py default: compile compile: $(UI_FILES) $(RESOURCE_FILES) %.py : %.qrc pyrc...

adding python packages to uClinux

I have distribution of uClinux, throught "menu config" I check python and compile("make"). I have python on my chip now. There is a binary executable file /bin/python. But what about python packages? There are only some basic packages as sys, time etc. I want to add for example package pyserial for serial port. Before compilation I ca...

hello everybody i have python use iewin question

Dear Everybody: I have some question, i use python control internet explorer(IE) COM use wx.lib.iewin. I hope use JavaScript control Python. So i need get GetIDsOfNames().-msdn but i can't get value ID or Names. Place help me Thanks ...

General network MVC framework for Python

I have been using Django for web-development, and have become quite fond of that framework. However, I would like to use a similar framework but for more general network applications. Is there such a framework? Or is it possible to modify Django to be able to have a more general network/protocol backend? ...

Handling unicode data in XMLRPC

I have to migrate data to OpenERP through XMLRPC by using TerminatOOOR. I send a name with value "Rotule right Aurélia". In Python the name with be encoded with value : 'Rotule right Aur\xc3\xa9lia ' But in TerminatOOOR (xmlrpc client) the data is encoded with value 'Rotule middle Aur\357\277\275lia' So in the server side, the data value...

Numpy broadcast array

Hi, I have the following array in NumPy: A = array([1, 2, 3]) How can I obtain the following matrices (without an explicit loop)? B = [ 1 1 1 2 2 2 3 3 3 ] C = [ 1 2 3 1 2 3 1 2 3 ] Thanks! ...

going next page using djangio Paginator creates a problem.

My google search application making a request each time while i am using paginator. Suppose i have a 100 records. Each page have to show 10 records so ten pages. When i click 2nd page it again sending a request. Ideally it should not send the request. ...

Sending large file to PIPE input in python

I have the following code: sourcefile = open(filein, "r") targetfile = open(pathout, "w") content= sourcefile.read(): p = Popen([SCRIPT], stdout=targetfile, stdin=PIPE) p.communicate(content) sourcefile.close() targetfile.close() The data in sourcefile is quite large, so it takes a lot of memory/swap to store it in 'content'. I tri...

python server pages : reading text fields

hi , I am very new to PSP(python server pages) and I need some code that can read a textfield in a html file and save it into a file. I want to use multiple text fields and do the same for them. Thanks In Advance ...

Why to copy a dictonairy from WSGI environment?

In the following example from wsgi.org is cur_named copied: def __call__(self, environ, start_response): script_name = environ.get('SCRIPT_NAME', '') path_info = environ.get('PATH_INFO', '') for regex, application in self.patterns: match = regex.match(path_info) if not match: continue extr...

regexp python with parsing html page

Good day. Little problem with regexp. I have a regexp that look like rexp2 = re.findall(r'<p>(.*?)</p>', data) And i need to grab all in <div id="header"> <h1></h1> <p> localhost OpenWrt Backfire<br /> Load: 0.00 0.00 0.00<br /> Hostname: localhost </p> </div> But my code doesnt work :( What im doing wrong? ...