Which are the most advanced frameworks and tools there are available for python for practicing Behavior Driven Development? Especially finding similar tools as rspec and mocha for ruby would be great.
I'd like to grab daily sunrise/sunset times from here. Is it possible to scrape web content with Python? what are the modules used? Is there any tutorial available?
Thanks
Is there any existing Python library that can validate data in Excel format? Or what kind of keyword should I use to search such an open source project? Thanks.
write a program to find the sum of the logarithms of all the primes from 2 to some number n, and print out the sum of the logs of the primes, the number n, and the ratio of these two quantities in python
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.
Hello all, I have a python script and am wondering is there any way that I can ensure that the script run's continuously on a remote computer? Like for example, if the script crashes for whatever reason, is there a way to start it up automatically instead of having to remote desktop. Are there any other factors I have to be aware of? The script will be running on a window's machine.
I'm using Python's subprocess.communicate() to read stdout from a process that runs for about a minute. How can I print out each line of that process's stdout in a streaming fashion, so that I can see the output as it's generated, but still block on the process terminating before continuing? subprocess.communicate() appears to give all the output at once.
I have a python module with a lot of variables. These variables are used and changed by many other modules. And I want to reload this module from itself when it happens (for refresh).
How to do that?
# ==================================
# foo.py
spam = 100
def set_spam(value):
spam = value
foo = reload(foo) # reload module from itself
# ==================================
# bar.py
import foo
print foo.spam # I expect 100
# assume that value changes here from some another modules (for example, from eggs.py, apple.py and fruit.py)
foo.set_spam(200)
print foo.spam # I expect 200
I am trying to host some files/rails app in the port 8080 for external access. For python I am using the SimpleHTTPServer module, and for rails, webrick. However, both of them does not work very well. I don't get the response back, and, sometimes, if I get it, it's VERY slow. Nevertheless, apache works very well on the port 8080 (i am not running them at the same time). What is going on?
When I run my python script in the shell terminal, it works
sudo myscript.py --version=22 --base=252 --hosts="{'hostA':[1],'hostB':[22]}"
But when I run in Hudson and Jenkins, using Execute Shell step, somehow, the string --hosts="{'hostA':[1],'hostB':[22]}" is interpreted as
sudo myscript.py --version=22 --base=252 '--hosts="{'hostA':[1],'hostB':[22]}"'
How do we overcome this so that our script would run in Jenkins and Hudson ?
Thank you.
Sincerely
Hi,
I want to create a dynamic object (inside another object) in python and then add attributes to it.
I tried:
obj = someobject
obj.a = object()
setattr(obj.a, 'somefield', 'somevalue')
but this didn't work.
Any ideas?
Thanks
I would like to know if there is something similar to PHP natsort function in python?
l = ['image1.jpg', 'image15.jpg', 'image12.jpg', 'iamge3.jpg']
l.sort()
gives:
['image1.jpg', 'image12.jpg', 'image15.jpg', 'iamge3.jpg']
but I would like to get:
['image1.jpg', 'iamge3.jpg', 'image12.jpg', 'image15.jpg']
I need to share a huge dictionary (around 1 gb in size) between multiple processs, however since all processes will always read from it. I dont need locking.
Is there any way to share a dictionary without locking?
The multiprocessing module in python provides an Array class which allows sharing without locking by setting
lock=false
however There is no such option for Dictionary provided by manager in multiprocessing module.
I have a python script on a linux server that I can SSH into and I want to run the script on the linux server( and pass it parameters entered by the user) and get the output on an ASP.net webpage running on IIS. How would I be able to do that?
Would it be easier if I was running a wamp server?
Edit: The servers are in the same internal intranet.
I've been hunting around for a Python CouchDB tutorial and haven't been able to find anything very thorough. The only thing I've really found is this site, which I haven't gotten to work because I keep getting a 'connection refused' error when I try to create a database.
Does anyone know where I would look for a tutorial to help me with this?
Can anyone point me to some documentation on how to write scripts in Python (or Perl or any other Linux friendly script language) that generate C++ code from XML or py files from the command line. I'd like to be able to write up some xml files and then run a shell command that reads these files and generates .h files with fully inlined functions, e.g. streaming operators, constructors, etc.
Hi,
I'm trying to send a Python list in to client side (encoded as JSON), this is the code snippet which I have written:
array_to_js = [vld_id, vld_error, False]
array_to_js[2] = True
jsonValidateReturn = simplejson.dumps(array_to_js)
return HttpResponse(jsonValidateReturn, mimetype='application/json')
So my question is how to access it form client side, can I access it like this:
jsonValidateReturn[0]
or how I assign a name to the returned JSON array in order to access it?
Hi all
I have the following 4 arrays ( grouped in 2 groups ) that I would like to merge in ascending order by the keys array.
I can use also dictionaries as structure if it is easier.
Has python any command or something to make this quickly possible?
Regards
MN
# group 1
[7, 2, 3, 5] #keys
[10,11,12,26] #values
[0, 4] #keys
[20, 33] #values
# I would like to have
[ 0, 2, 3, 4, 5, 7 ] # ordered keys
[20, 11,12,33,26,33] # associated values
I want to do a very simple webserver in python able to receive XML document over HTTP and then to send as response XML document.
Do you have any example?
just to understand How arrange the work...
many thanks!
The topic title pretty much says it all. Does anyone know how the built in dictionary type for python is implemented? My understanding is that it is some sort of hash table, but I haven't been able to find any sort of definitive answer.
I'm cocking this up and it should be really simple but the value of sortdate is none (note im only doing this because converting a string to a date in Python is a bugger).
DateToPass = str(self.request.get('startdate'))
mybreak.startdate = DateToPass
faf = DateToPass.split('-')
sortdate = str(faf[2] + faf[1] + faf[0])
That should work? but its just being stored as null though the datetopass is being stored fine.
I am looking for a good Tree data structure class. I have come across this package, but since I am relatively new to Python (not programming), I dont know if there are any better ones out there.
I'd like to hear from the Pythonistas on here - do you have a favorite tree script that you regularly use and would recommend?
I want certain functions in my application to only be accessible if the current user is an administrator.
How can I determine if the current user is in the local Administrators group using Python on Windows?