This question is for learning purposes. Suppose I am writing a simple SQL admin console using CGI and Python. At http://something.com/admin, this admin console should allow me to modify a SQL database (i.e., create and modify tables, and create and modify records) using an ordinary form.
In the least secure case, anybody can access htt...
I'm debugging an script that I'm writing and the result of
executing a statement from pdb does not make sense so my
natural reaction is to try to trace it with pdb.
To paraphrase:
Yo dawg, I like python, so can you put my pdb in my pdb so I can debug while I debug?
...
I have read most of the posts on here regarding floating point, and I understand the basic underlying issue that using IEEE 754 (and just by the nature of storing numbers in binary) certain fractions cannot be represented. I am trying to figure out the following: If both Python and JavaScript use the IEEE 754 standard, why is it that exe...
i have the following code which is trying to add a set of videos into a youtube play list
import urllib,re
import gdata.youtube
import gdata.youtube.service
class reddit():
def __init__(self, rssurl ='http://www.reddit.com/r/chillmusic.rss' ):
self.URL = rssurl
self._downloadrss()
def _downloadrss(self):
...
I'm currently in need of a (preferably open-source) free push server, that supports both linux and windows. I need something similar to the Ajax Push Engine, but that project unfortunatelly does not work on windows (I could use a virtual machine, but that's not what I'm looking for).
I need to be able to push information to/from a pytho...
Hey,
I'm trying to make a global hotkey with pyhook in python that is supposed to work only with the alt key pressed.
here is the source:
import pyHook
import pythoncom
hm = pyHook.HookManager()
def OnKeyboardEvent(event):
if event.Alt == 32 and event.KeyID == 49:
print 'HERE WILL BE THE CODE'
hm.KeyDown = OnKeyboardEve...
I don't think i fully understand character sets so i was wondering if anyone would be kind enough to explain it in layman's terms with examples ( for Dummies).I know there is utf8, latin1(ISO 8859-1), ascii ect
The more answers the better really.
Thank you in advance;-)
...
I have a piece of code that behaves differently depending on whether I go through a dictionary to get conversion factors or whether I use them directly.
The following piece of code will print 1.0 == 1.0 -> False
But if you replace factors[units_from] with 10.0 and factors[units_to ] with 1.0 / 2.54 it will print 1.0 == 1.0 -> True
#!...
I am using paramiko/ssh/python to attempt to run a command on a remote server. When I ssh manually and run the command in question, I get the results I want. But if I use the python (co-opted from another thread on this site) below, there is no returned data. If I modify the command to be something more basic like 'pwd' or 'ls' I can the...
Does anyone know of a memory efficient way to generate very large xml files (e.g. 100-500 MiB) in Python?
I've been utilizing lxml, but memory usage is through the roof.
...
Hi folks,
I'm using popen in order to send a few commands within a Django app.
Problem is that I'm getting [Error 5] Access Denied, apparently I have no access to cmd.exe, which popen seems to use.
WindowsError at /test/cmd/
[Error 5] Access is denied: 'C:\WINDOWS\system32\cmd.exe /c dir'
I reckon this is because the app sit...
What are the most 'tricky questions' you came across concerning python (ie during job interview) ? You can also give a sample solution of the problem. Mine :
How in one line add to arguments of workers names list their positional numbers ( list=[jon,michael,rob,bill] ).
...
I'm trying to use python to determine if one (small) image is within another (large) image.
Any suggestions before I take myself completely down the wrong path?
/edit: Ok, some ideas: I'm using PIL, and I'm converting each image to the 'P' mode so I can compare each pixel as an integer. I'm trying to implement something like a Boye...
Hello,
I am about to take the head long plunge into Zope land and am wondering which framework would fit my needs better. I have some experience toying around with django and the primary reason I am switching to a zope-based framework is ZPT and also needing to occasionally do things with Plone. Both seem to be well run projects I a...
I need to create a function to rotate a given matrix (list of lists) clockwise, and I need to use it in my Table class. Where should I put this utility function (called rotateMatrixClockwise) so I can call it easily from within a function in my Table class?
...
If I have an MP3 file how can I convert it to a WAV file? (preferably, using a pure python approach)
...
I'm running a Django project on Postgresql 8.1.21 (using Django 1.1.1, Python2.5, psycopg2, Apache2 with mod_wsgi 3.2). We've recently encountered this lovely error:
OperationalError: FATAL: connection limit exceeded for non-superusers
I'm not the first person to run up against this. There's a lot of discussion about this error, speci...
My mod_wsgi django application seems to keep getting reloaded for the first several requests that the client makes. This is killing my performance
After enough requests it seems to settle down, and the application no longer seems to be getting reloaded. Any thoughts on why this is happening and how I can prevent it?
(I have the followi...
How does Python (2.6.4, specifically) determine list membership in general? I've run some tests to see what it does:
def main():
obj = fancy_obj(arg='C:\\')
needle = (50, obj)
haystack = [(50, fancy_obj(arg='C:\\')), (1, obj,), needle]
print (1, fancy_obj(arg='C:\\'),) in haystack
print needle in haystack
if __nam...
Trying to implement a web service which should have exactly the same function as http://www.google.com/finance the search quotes box
when user type the stock name or company name, the right stock name is suggested while typing.
my service will using historical information from google finance, so get proper quote name from google is a m...