I need to get a path to the GIT on Max OS X 10.6 using Python 2.6.1 into script variables. I use this code for that:
r = subprocess.Popen(shlex.split("which git"), stdout=subprocess.PIPE)
print r.stdout.read()
but the problem is that output is empty (I tried stderr too). It works fine with another commands such as pwd or ls.
Can any...
Hi,
I was studying introspection in Python, and as I was getting through basic examples, I found out that the callable built-in function is no longer available in Python 3.1.
How can I check if a method is callable now?
Thank you
...
I'm running CentOS 5, and am trying to get a django application working with mod_wsgi. I'm using .wsgi settings I got working on Ubuntu. I'm also using an alternate installation of python (/opt/python2.6/) since my django application needs >2.5 and the OS uses 2.3
Here is the error:
[Thu Mar 04 10:52:15 2010] [error] [client 10.1.0.251...
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...
Let's say I have an user registration form. In this form, I have the option for the user to upload a photo. I have an User table and Photo table. My User table has a "PathToPhoto" column. My question is how do I fill in the "PathToPhoto" column if the photo is uploaded and inserted into Photo table before the user is created? Another...
what is the best module /package in python to use des /3des for encryption /decryption.
could someone provide example to encrypt data with des/3des on python.
...
We have server on Python and client + web service on Ruby. That works only if file from URL is less than 800 k. It seems like "socket.puts data" in a client works, but "output = socket.gets" - not. I think problem is in a Python part. For big files tests run "Connection reset by peer". Is it buffer size variable by default somewhere in a...
Hi all,
I'm writing a Python+Qt4 application that would ideally need to pop up a window every once in a while, to display pdf documents and allow very basic operations, namely scrolling through the different pages and printing the document.
I've found the reportLab to create pdf files, but nothing about pdf viewers. Does anyone knows a...
I want to write a decorator that acts differently depending on whether it is applied to a function or to a method.
def some_decorator(func):
if the_magic_happens_here(func): # <---- Point of interest
print 'Yay, found a method ^_^ (unbound jet)'
else:
print 'Meh, just an ordinary function :/'
return func
cla...
Hi friends,
I need to execute this python script: http://superjared.com/static/code/googleMX.py
I installed pyactiveresource, but when I execute: python googleMX.py I have this return.
Traceback (most recent call last):
File "googleMX.py", line 15, in ?
from pyactiveresource import ActiveResource
ImportError: cannot import name Active...
Hello,
I have a question about the proper, best way to manage the model.
I am relative newbie to django, so I think I need to read more docs, tutorials,etc (suggestions for this would be cool!).
Anyway, this is my question :
I have a python web crawler, that is "connected" with django model.
Crawling is done once a day, so its really...
Paste Deploy can reference code with uris such as
[section]
use = egg:FooBar#baz
What is the full syntax for these uris?
...
hi
i have the following models setup
class Player(models.Model):
#slug = models.slugField(max_length=200)
Player_Name = models.CharField(max_length=100)
Nick = models.CharField(max_length=100, blank=True)
Jersy_Number = models.IntegerField()
Team_id = models.ForeignKey('Team')
Postion_Choices = (
('M', ...
My problem is the following:
I have a 2-minute long WAV file, and my aim is to insert another WAV file (7 seconds long), at a certain point in the first WAV file (say, 0:48), essentially combining the two WAVs, using python. Unfortunately I haven't been able to figure out how to do that, and was wondering if there was some obvious soluti...
This question is about implementing the full Perl autovivification in python. I know similar questions were asked before and so far the best answre is http://stackoverflow.com/questions/635483/what-is-the-best-way-to-implement-nested-dictionaries-in-python/652284#652284. However, I'm looking to do this:
a['x']['y'].append('z')
without...
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. The application code derives f...
Hello,
Besides using Appcelerator's Titanium Desktop, are there other approaches to integrating Javascript and Ruby/Python into cross-platform desktop applications? Just trying to get a sense of the landscape here. From searching the web, it seems Titanium may be leading the charge in terms of this type of integration. I wasn't able ...
I am looking for python stubbing library. Something that could be used to create fake classes/methods in my unit tests.. Is there a simple way to achieve it in python..
Thanks
PS: I am not looking for mocking library where you would record and replay expectation.
Difference between mock and stubs
...
Can anyone explain usage of weak references?
The documentation doesn't explain it precisely, it just says that the GC can destroy the object linked to via a weak reference at any time. Then what's the point of having an object that can disappear at any time? What if I need to use it right after it disappeared?
Can you please explain th...
What is their purpose? What problems do they solve?
Thanks.
...