I am trying to set a cron task to read updates for a Facebook application. I have prompted the user to grant Offline Access permissions and i have store the session_key in the db.
I am crearing a new Facebook object and besides api and secret key I also use the session_key (previously stored in db) and the fb uid. When i am trying to cr...
I use testoob in the following way:
def suite():
import unittest
return unittest.TestLoader().loadTestsFromNames([
'my_module.my_unittest_class',
'my_module.my_other_unittest_class',
])
if __name__ == '__main__':
import testoob
testoob.main(defaultTest="suite")
And then run the unittest suite wit...
We have an ArrayList of items in several classes which are giving me trouble every time I'd like to insert a new item into the list. It was a mistake on my part to have designed the classes in the way I did but changing the design now would be more headache than it's worth (bureaucratic waterfall model.) I should have anticipated forma...
I want to restrict access to urls serves by django generic views. For my views i know that login_required decorator does the job. Also Create/update/delete generic views takes login_requied argument but I couldn't find a way to do this for other generic views.
...
First off, I'm aware of eval's disadvantages and it will be used in an experiment I want to make only.
I'm creating a script that works just like a Brute-Force algorithm but it won't break passwords but find the solution to a special form of an equation (more details are unnecessary).
There will be lots of strings filled with (often sy...
I'm working on a project that is hosted @ Github.com
It seems that forum/models.py has some errors in it that are preventing me from syncdb.
I was curious if there was a way to search through the network to find all the changes that had been made in the entire Branch Network to forum/models.py to see if someone had fixed the errors alre...
I've been trying to install PyQt 4.7 on Vista, but I am getting an ImportError when I try to do: from PyQt4 import QtCore, QtGui.
ImportError: DLL load failed: The specified module could not be found.
I've checked my System Path, and C:\Python31\Lib\site-packages\PyQt4\bin is on there.
I can't run any of the examples, but the Des...
To annotate my figures with Greek letters in the matplotlib package of Python, I use the following:
import matplotlib
matplotlib.use('PDF')
import matplotlib.pyplot as plt
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
plt.rcParams['ps.useafm'] = True
rc('font',**{'family':'sans-serif','sans-se...
Why is print(x) here not valid (SyntaxError) in the following list-comprehension?
my_list=[1,2,3]
[print(my_item) for my_item in my_list]
To contrast - the following doesn't give a syntax error:
def my_func(x):
print(x)
[my_func(my_item) for my_item in my_list]
...
hi
How can I convert a .wav file to some other format such as .mp3 in pygame?
Update:
Why not Gstreamer or Pygame:
I want to use native Windows environment to install a package that can do this (i.e. don't want to install cygwin). I am searching for a package which has a binary installer available for windows (with Python 2.6) or at...
Is it, in Python, possible to adress a specific character in a string by the standard array syntax?
Example, PHP:
$foo = 'bar';
echo $foo[1]; // Output: a
It didn't work like in PHP so I wanted to know if it is possible using some other way
...
Working on a script to collect users browser history with time stamps ( educational setting).
Firefox 3 history is kept in a sqlite file, and stamps are in UNIX epoch time... getting them and converting to readable format via a SQL command in python is pretty straightforward:
sql_select = """ SELECT datetime(moz_historyvisits.visit_date...
I want to use Python bindings for GStreamer on windows. But looking at the INSTALL file, the gstreamer does it in the unix way. (make make install) . I don't want to install cygwin or other windowsunix environments.
Is there a GPL binary distribution of GStreamer available somewhere? (or a script that can just install it using python s...
Hello, we are still pretty new to Postgres and came from Microsoft Sql Server.
We are wanting to write some stored procedures now. Well, after struggling to get something more complicated than a hello world to work in pl/pgsql, we decided it's better if we are going to learn a new language we might as well learn Python because we got th...
hi,
I am trying to install latest version of Pymedia from sources. I have Python2.6 and there is no binary available.
Started with:
python setup.py build
and got the following messages:
Using WINDOWS configuration...
Path for OGG not found.
Path for VORBIS not found.
Path for FAAD not found.
Path for MP3LAME not found.
Path ...
I have a problem with python here. If I pass an array through a recursive function that adds something to the array each time it is called, the array is modified in each instance
Code:
def test(n,myList):
if n>0:
myList.append("Test")
print ( "BEFORE CALL Instance ", n, myList )
test(n-1,myList)
pri...
I have a queryset with a few million records. I need to update a Boolean Value, fundamentally toggle it, so that in the database table the values are reset. What's the fastest way to do that?
I tried traversing the queryset and updating and saving each record, that obviously takes ages? We need to do this very fast, any suggestions?
...
def welcomeStage (self):
self.test = QtGui.QLineEdit (self)
self.test.move (50, 150)
QtCore.QObject.connect (self.test, QtCore.SIGNAL ('returnPressed()'), self.passwordStage)
def passwordStage (self):
self.email = self.test.text()
self.test.clear()
self.test.setEchoMode (QtGui.QLineEdit.Password)
QtC...
I've recently taken it as a project to teach myself how to program in Python. Overall, I must say that I'm impressed with it.
In the past I've typically stuck to programming in VBA mostly for MS Excel (but also a bit in MS Access and Word) and have struggled to find ways to make it do things that Python can easily do with a single comm...
Hi, so...
I have a huge list ranked by various values (eg. scores)
So I grab the list ordered by these values:
players = Player.objects.order_by('-score', '-karma')
I would like to:
Grab a player and get the neighbouring players
P1 score:123
P2 score:122
YOU! score:110
P3 score:90
P2 score:89
Grab the...