I have an little app I wrote in Python and it used to work... until yesterday, when it suddenly started giving me an error in a HTTPS connection. I don't remember if there was an update, but both Python 2.7.3rc2 and Python 3.2 are failing just the same.
I googled it and found out that this happens when people are behind a proxy, but I'm not (and…
I'm trying to write a python wrapper for some C++ code that make use of OpenCV but I'm having difficulties returning the result, which is a OpenCV C++ Mat object, to the python interpreter.
I've looked at OpenCV's source and found the file cv2.cpp which has conversions functions to perform conversions to and fro between PyObject* and OpenCV's…
I have the following python code:
try:
pr.update()
except ConfigurationException as e:
returnString=e.line+' '+e.errormsg
This works under python 2.6, but the "as e" syntax fails under previous versions. How can I resolved this? Or in other words, how do I catch user-defined exceptions (and use their instance variables) under…
How do I install mod_python to run with Python 2.6 on a Windows machine? I could not find an installer for Python 2.6.
I downloaded this installer for (mod_python on Python 2.5): mod_python-3.3.1.win32-py2.5-Apache2.2.exe and extracted it to get PLATLIB and SCRIPTS folders. Where do I go from here?
I have music playing program made using PySide which uses Phonon to playback audio. I updated to MacOS X Mavericks a few days ago, which meant I needed to reinstall PySide. I'm not sure which of these actions has caused this, but now whenever I try to create a Phonon MediaObject I get a Segmentation Fault: 11 from Python.
It's not just in…
When I run a python script in a terminal it runs as expected; downloads file and saves it in the desired spot.
sudo python script.py
I've added the python script to the root crontab, but then it runs as it is supposed to except it does not write the file.
$ sudo crontab -l
> * * * * * python /home/test/script.py >>…
I use emacs for all my code edit needs. Typically, I will use M-x compile to run my test runner which I would say gets me about 70% of what I need to do to keep the code on track however lately I've been wondering how it might be possible to use M-x pdb on occasions where it would be nice to hit a breakpoint and inspect things.
In…
I have a C++ class like this:
class ConnectionBase
{
public:
ConnectionBase();
template <class T> Publish(const T&);
private:
virtual void OnEvent(const Overload_a&) {}
virtual void OnEvent(const Overload_b&) {}
};
My templates & overloads are a known fixed set of types at compile time.…
Python interpreter has a Global Interpreter Lock, and it is my understanding that extensions must acquire it in a multi-threaded environment. But Boost.Python HOWTO page says the extension function must release the GIL and reacquire it on exit.
I want to resist temptation to guess here, so I would like to know what should be…
I am building an application which, at the moment, consists of many small Python scripts.
Each Python script processes items from one Amazon SQS queue. Emails come into an initial queue and are processed by a script and typically the script will do a small unit of processing (for example, parse email and store some database…
I've started programming about a year ago, I've learned the C and C++ languages and bits of Java. Recently I've started to learn the Python language (Notable: I'm using the Eclipse IDE).
I'm used to formatting my code with whitespace, placing statements a bit to the right of my code for easier readability. Since I started…
I have a FORTRAN program that is called from a Python script (as an ArcGIS tool). I need to pass an array, Raster_Z(i,j), from FORTRAN to python.
I have read about the Python subprocess module; however, I have not had much luck in understanding how to do this with FORTRAN. All examples I have found involve simple unix…
I'm having some trouble seeing what the best way to wrap a series of classes with Boost.Python while avoiding messy inheritance problems. Say I have the classes A, B, and C with the following structure:
struct A {
virtual void foo();
virtual void bar();
virtual void baz();
};
struct B : public A {
…
In choosing a technology for internet applications where the number of users may scale over time, which one should we consider: Java or Python? What are the considerations in choosing one and not the other? If speed and scalability is our main criteria, which one should we use?
We have looked around and it seems…
OK, here is a simple Python class:
class AddSomething(object):
__metaclass__ = MyMetaClass
x = 10
def __init__(self, a):
self.a = a
def add(self, a, b):
return a + b
We have specified a metaclass, and that means we could write something like this:
class MyMetaClass(type):
…
I come from php community and just started learning Python. I have to create server-side scripts that manipulate databases, files, and send emails.
Some of it I found hard to do in python, comparing to php, like sending emails and querying databases.
Where in php you have functions like mysql_query(), or…
Hello All Python Pro's ,
I'm using mamp server for testing out all my web pages. I'm new to python. I'm able to run a script in python interpreter that will normally print a hello world.
print "Hello World!"
So i used the same line in a file with name test.py . So how should I run this on web.
As…
Python first appeared in 1991, but it was somewhat unknown until 2004, if the TIOBE rankings quantify anything meaningful.
What happened? What caused the interest in this 13 year old language to go through the roof? Is there a reason that Python wasn't considered a real competitor to Perl in its first…
After reading some Python material and seeing some Python code a few years back I decided to give it a whirl. I decided to start with Python to solve the problems on Project Euler and was throughly impressed with the language. Since then I've went on to learn Django, and now use it primarily for my…
I got the following problem. I have written a C-Extension to Python to interface a self written software library. Unfortunately I need to return two values from the C function where the last one is optional. In Python the equivalent is
def func(x,y):
return x+y, x-y
test = func(13,4) #only…
I'm looking for a python platform or environment.
I'm looking for something like or similar to easyphp ou xampp for try and learn some cms.
i've find mezzanine cms http://mezzanine.jupo.org/ and skeletonz http://orangoo.com/skeletonz/
usually i use and know apache environment. But python is new for…
After reading some Python material and seeing some Python code a few years back I decided to give it a whirl. I decided to start with Python to solve the problems on ProjectEuler.net and was throughly impressed with the language. Since then I've went on to learn Django, and now use it primarily…
I'm a perl scripter working in python and need to know a way to do the following perl in python.
$Hash{$key1}[$index_value]{$key2} = $value;
I have seen the stackoverflow question here: List of dictionaries, in a dictionary - in Python
I still don't understand what self.rules is doing or if…
What are the best practices for extending a python module -- in this case I want to extend python-twitter by adding new methods to the base API class.
I've looked at tweepy, and I like that as well, I just find python-twitter easier to understand and extend with the functionality I want.
I…