What would be the best method to restrict access to my XMLRPC server by IP address? I see the class CGIScript in web/twcgi.py has a render method that is accessing the request... but I am not sure how to gain access to this request in my server. I saw an example where someone patched twcgi.py to set environment variables and then in th...
ax.plot_date((dates, dates), (highs, lows), '-')
I'm currently using this command to plot financial highs and lows using matplotlib. It works great, but I also need the option to remove the blank spaces in the x-axis left by days without market data, such as weekends and holidays.
I have lists of dates, highs, lows, closes and opens....
I'm trying to port my Python app from Windows to Mac. My app uses Psyco. How exactly do I install Psyco on Mac?
Keep in mind I'm a Mac newbie.
...
I'm trying to export animation from blender, here's what I've done so far:
--- This is just to give you an idea of what I'm doing and I've left out a lot to keep it short.
--- If it's too confusing or if it's needed I could post the whole source.
# Get the armature
arm = ob.getData()
# Start at the root bone
for bone in bones:
...
Hi,
Let's say i have 2 strings 'Jan-2010' and 'Mar-2010' and i want to parse it such that it returns 2 datetime objects: 1-Jan-2010 and 31-Mar-2010 (i.e. the last day).
What would be the best strategy in python? Should i just split the string into tokens or use regular expressions and then use the calendar functions to get say the la...
I'm quite new to python and GAE, can anyone please provide some help/sample code for doing the following simple task? I managed to read a simple file and output it as a webpage but I need some slightly more complicated logic. Here is the pseudo code:
open file;
for each line in file {
store first line as album title;
for eac...
I'm trying to run this test: self.assertRaises(AttributeError, branch[0].childrennodes), and branch[0] does not have an attribute childrennodes, so it should be throwing an AttributeError, which the assertRaises should catch, but when I run the test, the test fails because it is throwing an AttributeError.
Traceback (most recent call la...
I want to put output information of my program to a folder. if given folder is not exit, then program should create a new folder with folder name as given in the program. is it possible?
if yes please let me how. suppose i have given folder path like "C:\Program Files\alex"
and alex folder doesn't exist then program should create alex fo...
I have the Python expression n <<= 1
How do you express this in PHP?
...
I'm trying to generate a text file that has a list of all files in the current directory and all of its sub-directories with the extension ".asp". What would be the best way to do this?
...
My problem is I'm not sure how to interface them. Do I need to have pidgin installed in a particular way in order for dbus to interface with it? and if not does the pidgin gui have to be running in order for dbus to utilize it?
...
I am always annoyed by this fact:
$ cat foo.py
def foo(flag):
if flag:
return (1,2)
else:
return None
first, second = foo(True)
first, second = foo(False)
$ python foo.py
Traceback (most recent call last):
File "foo.py", line 8, in <module>
first, second = foo(False)
TypeError: 'NoneType' object is not it...
I have a string that kind of looks like this:
"stuff . // : /// more-stuff .. .. ...$%$% stuff -> DD"
and I want to strip off all punctuation, make everything uppercase and collapse all whitespace so that it looks like this:
"STUFF MORE STUFF STUFF DD"
Is this possible with one regex or do I need to combine more than two? This i...
Hi all. In the below file I have 3 occurrences of '.1'. I want to eliminate the last one and write the rest of file to a new file. Kindly suggest some way to do it in PYTHON and thank you all.
d1dlwa_ a.1.1.1 (A:) Protozoan/bacterial hemoglobin {Ciliate (Paramecium caudatum) [TaxId: 5885]}
slfeqlggqaavqavtaqfyaniqadatvatffngidmpnqt...
I'm building my first form with django, and I'm seeing some behavior that I really did not expect at all. I defined a form class:
class AssignmentFilterForm(forms.Form):
filters = []
filter = forms.ChoiceField()
def __init__(self, *args, **kwargs):
super(forms.Form, self).__init__(*args, **kwargs)
self.filters.append(PatientFilter('A...
I have currently an enviroment with Django + Apache via mod_python. How can I use Staticgenerator without nginx, just with Apache and mod_python? Thank you.
...
Understandably many of the tickets we file in Trac contain tracebacks. It would be excellent if these were nicely formatted and syntax highlighted.
I've conducted a cursory Google search for a Python traceback wiki processor and have not found any quick hits.
I'm happy to roll my own if anyone can recommend a traceback formatter (stand...
Hello all. I am working on a top-down view 2d game at the moment and I am learning a ton about sprites and sprite handling. My question is how to handle a set of sprites that can be rotated in as many as 32 directions.
At the moment a given object has its sprite sheet with all of the animations oriented with the object pointing at 0 deg...
I didn't really pay as much attention to Python 3's development as I would have liked, and only just noticed some interesting new syntax changes. Specifically from this SO answer function parameter annotation:
def digits(x:'nonnegative number') -> "yields number's digits":
# ...
Not knowing anything about this, I thought it could ...
What I am trying to do is pretty simple: yet something has clearly gone awry.
On the Front-End:
function eval() {
var x = 'Unchanged X'
$.get("/", { entry: document.getElementById('entry').value },
function(data){
x = data;
}
);
$("#result").html(x);
}
On the Back-End:
class MainHandl...