I'm trying to use a regex as an input, and from there generate all the possible values that the regex would match.
So, for example, if the regex is "three-letter words starting with a, and ending in c," then the code would generate a list with the values [aac, abc, acc, adc, a1c....].
Is there an easy way to do this? I'm using python.
...
I've been searching for a media player that can display sub-second resolution in videos. Some pointed me to the Frame stepping functionality in MPC, but I'd like even more than that.
I know from previous experience with wxPython that the wx.media.MediaCtrl both displays and (as fast as i can click with the mouse anyway) stops the video ...
can someone please explain this to me??? this doesn't make any sense to me....
I copy a dictionary into another and edit the second and both are changed????
ActivePython 3.1.0.1 (ActiveState Software Inc.) based on
Python 3.1 (r31:73572, Jun 28 2009, 19:55:39) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or...
Hello everyone,
I am working on a python app which
needs to expose some services. For that
task I was testing ZSI. Everything was fine
until I tried to send binaries through the
web service.
The tested escenario looks like this:
A WSDL for the WS (to execute wsdl2py / wsdl2dispatch)
A response including a Base64 encoded binary
The p...
I'm using ruffus to write a pipeline. I have a function that gets called in parallel many times and it creates several files. I'd like to make a function "combineFiles()" that gets called after all those files have been made. Since they run in parallel on a cluster, they will not all finish together. I wrote a function 'getFilenames(...
I unsuccessfully tried using txredis (the non blocking twisted api for redis) for a persisting message queue I'm trying to set up with a scrapy project I am working on. I found that although the client was not blocking, it became much slower than it could have been because what should have been one event in the reactor loop was split up ...
Is it possible to create an object from a dictionary in python in such a way that each key is an attribute of that object?
Something like this:
dict = { 'name': 'Oscar', 'lastName': 'Reyes', 'age':32 }
e = Employee( dict )
print e.name # Oscar
print e.age + 10 # 42
I think it would be pretty much the inverse of this question:...
Hello,
I'm attempting to write a script to generate SSH Identity key pairs for me.
from M2Crypto import RSA
key = RSA.gen_key(1024, 65337)
key.save_key("/tmp/my.key", cipher=None)
The file /tmp/my.key looks great now.
By running ssh-keygen -y -f /tmp/my.key > /tmp/my.key.pub I can extract the public key.
My question is how can I ext...
Possibly a horribly stupid question: will the pywin32 extensions work on Windows 7? If not, does anyone know of plans for windows 7 extensions for python?
...
http://code.google.com/appengine/docs/python/tools/uploadingdata.html is not clearly understand. Where i should call the bulkloader.py or appcfg.py? Should i import the csv file to local Google App Engine SDK first? How to keep the upload and download data process in existing application for datastore synchronization?
...
I'm using Eclipse for writing Python, and I want to be able to easily clear the screen. I've seen this question, and tried (among other things suggested there) the following solution
import os
def clear():
os.system('cls' if os.name == 'nt' else 'clear')
but it doesn't entirely solve my problem. Instead of clearing the screen, th...
I got a function like
def f():
...
...
return [list1, list2]
this returns a list of lists
[[list1.item1,list1.item2,...],[list2.item1,list2.item2,...]]
now when I do the following:
for i in range(0,2):print f()[i][0:10]
it works and print the lists sliced
but if i do
print f()[0:2][0:10]
then it prints the lists ...
Sometimes my whole Django based site goes into 504 gateway timeout errors so none page can be displayed.
Is it possible to write a shell program and cronjob it run every 5 minutes to detect such errors and restart FastCGI process if needed?
I'm currently using command below to restart FastCGI in case it's crashed but it doesn't work fo...
I am trying to implement my own authentication method for AuthKit and am trying to figure out how some of the built-in methods work. In particular, I'm trying to figure out how to update the REMOTE_USER for environ correctly.
This is how it is handled inside of authkit.authenticate.basic but it is pretty confusing. I cannot find anyplac...
I'm trying to access my pylons application via cron job to send notifications to my users. The way I'm doing this is by running the application using something like:
paster request myconfig.ini /maintenance/do
In the actual controller I check for the "paste.command_request" to block public access. Everything works but the only problem...
Hello,
I have written this small Django view to return pdf.
@login_required
def code_view(request,myid):
try:
deal = Deal.objects.get(id=myid)
except:
raise Http404
header = deal.header
code = deal.code
response = HttpResponse(mimetype='application/pdf')
response['Content-Disposition'] = 'attachm...
Hi,
I wrote a python module. Running python filename.py, only checks for syntax errors. Is there a tool, which checks for runtime errors also, like concatenating int with string etc..
Thank you
Bala
Update:
Scripts are mainly about setting up a hadoop cluster in the cloud. I am not sure how I can write a unit test, because everyt...
I'm really new to programming... I set up a class to give supporting information for Google's User API user object. I store this info in the datastore using db.model.
When I call the okstatus method of my user_info class using this code:
elif user_info.okstatus(user):
self.response.out.write("user allowed")
I get this error:
un...
I've got some dynamically-generated boolean logic expressions, like:
(A or B) and (C or D)
A or (A and B)
A
empty - evaluates to True
The placeholders get replaced with booleans. Should I,
Convert this information to a Python expression like True or (True or False) and eval it?
Create a binary tree where a node is either a bool or ...
How would I download files (video) with Python using wget and save them locally? There will be a bunch of files, so how do I know that one file is downloaded so as to automatically start downloding another one?
Thanks.
...