Python is an interpreted, general-purpose high-level programming language whose design philosophy emphasizes code readability.
0
votes
0answers
3 views
closing hanging zmq socket from another thread
Is there some way to close a specific hanging recv zmq socket from another thread in Python without clobbering other sockets that may be in use? The following code doesn't seem to exit; replacing the ...
0
votes
1answer
26 views
Best way to save a captcha, and then solve it manually?
Im working on automating some scripts for a website i enjoy going to, i am getting ready to start development on some captcha solving scripts, at first i just wanna save the captchas it runs into to ...
0
votes
0answers
9 views
Publishing on Facebook fan page with Python
I tried a couple of codes about how to publish on Facebook wall. But I would like do a little bit different. I wonder publish in my facebook fan page. The following code just publish on my personal ...
1
vote
2answers
71 views
How to create a list of random integer vector whose sum is x
Creating a random vector whose sum is X (e.g. X=1000) is fairly straight forward:
import random
def RunFloat():
Scalar = 1000
VectorSize = 30
RandomVector = [random.random() for i in ...
0
votes
0answers
7 views
Swig shared_ptr macro with templated class and derived classes
This question is in some ways an extension of the question posted here:
SWIG_SHARED_PTR macro with templated class
Although perhaps the issue is entirely unrelated.
The basic set up is this: I am ...
0
votes
1answer
9 views
Tutorial for OAuth in App Engine (Python)
I know the basics of App Engine and Python. I am right now trying to write a web app to ask the user to log in with OAuth and then display their email address. Do you know any tutorial that teaches ...
0
votes
0answers
14 views
Urllib and urllib2 returns “IOError: [Errno socket error] [Errno -2] Name or service not known” but Firefox downloads file with no trouble
I am trying to download GRIB data (binary weather forecast data) from the National Weather Service. I have written Python code to format the HTTP string to get data for today, looking 12 hours ahead.
...
0
votes
0answers
16 views
Python unittest passing arguments
In python how would I pass an argument form the command line to a unittest function. Here is the code so far... I know it's wrong.
class TestingClass(unittest.TestCase):
def testEmails (self):
...
1
vote
2answers
27 views
How to match multiple instance with the same pattern in a matching using python
Consider the following string as a example,
str = '(Obsoletes RFC0011) (Updated by RFC0036, RFC0047) (Status: UNKNOWN)'
I want to extract key-value pairs like this:
matchobj['Obsoletes'] = ...
0
votes
0answers
11 views
App Engine : sub folder in templates
I'm using template to separate HTML and Python Code. I create templates folder. in this folder, I create index.html. Here is my code :
template_dir = ...
2
votes
2answers
51 views
Python coin-toss
i am new to Python, and i can't wrap my head around this. I have following function defined:
def FlipCoins(num_flips):
heads_rounds_won = 0
for i in range(10000):
heads = 0
...
1
vote
1answer
17 views
Why does python's imp.reload() not delete old classes and functions?
I just recognized that imp.reload() does not delete old classes and functions if they were deleted from the module's source file.
An Example:
:~$ python3
Python 3.2.3 (default, May 3 2012, ...
0
votes
1answer
23 views
Accessing functions in python script from php
I have a web application written in PHP. In a few places I make calls to python script through exec(). I was wondering if there is a better way of doing this. I was thinking about creating soap ...
1
vote
1answer
24 views
Why doesn't Apache display 404 errors with Django and mod_wsgi?
With my current Apache & Django setup, when I go to a page that does not exist, the root page for the website is displayed rather than a 404 error. Here is my httpd.conf file:
Alias /robots.txt ...
2
votes
3answers
44 views
Newbie variable passing
I'd really appreciate if you could give me a quick hand with this little problem I'm having. So far in programming, I've done some C, but I'm confused as to how to pass variables through functions in ...