I'm attempting to use savepoints with the sqlite3 module built into python 2.6. Every time I try to release or rollback a savepoint, I always recieve an OperationalError: no such savepoint. What am I missing?
python version: 2.6.4 (r264:75821M, Oct 27 2009, 19:48:32)
[GCC 4.0.1 (Apple Inc. build 5493)]
PySQLite version: 2.4.1
sqlite3...
pypy
has many built-in function use python implementation.example:link
but,i can't find model 'sys' implementation.
how can i get it.
import sys
print help(sys)
...
I have a module installed in the main python install, however, I'd like to install this module into my virtualenv and I'd like it to be portable, how can I do that?
I'm getting this error:
(v_env)[nubela@nubela-desktop zine-ified]$ pip -E v_env install pyfacebook
Requirement already satisfied (use --upgrade to upgrade): pyfacebook in /...
I want to get a related [things/questions] in my app, similar to what StackOverflow does, when you tab out of the Title field.
I can think of only one way to do it, which i think might be fast enough
Do a search for the title in corpus of titles of all [things], and return first x matches. We can use whatever search is being used for ...
Hi,
I wrote a recursive function to find the no. of instances of a substring in the parent string.
The way I am keeping count is by declaring/initialising count as a global variable outside the function's scope. Problem is, it'll give me correct results only the first time the function is run, because after that count != 0 to begin with....
I am a Python/web programmer.
Now, I would like to transition to building applications for the Mac.
Please tell me--what do I have to learn to get started?
What books would you recommend?
...
Is there any web-based IDE that I can use to run quick tests? There're a dozen for PHP and some for even Java but I haven't found yet that runs Python. If there's an open-source IDE available that I can host and run myself, that'd be better.
Thanks
...
hmm, is there any reason why sa tries to add Nones to for varchar columns that have defaults set in in database schema ?, it doesnt do that for floats or ints (im using reflection).
so when i try to add new row :
like
u = User()
u.foo = 'a'
u.bar = 'b'
sa issues a query that has a lot more cols with None values assigned to those, and d...
I don't really understand how yield statement works in this situation. The problem says that given an expression without parentheses, write a function to generate all possible fully parenthesized (FP) expressions. Say, the input is '1+2+3+4' which should be generated to 5 FP expressions:
(1+(2+(3+4)))
(1+((2+3)+4))
((1+2)+(3+4))
((1+(2...
I'd like to find out, exactly what variables are available when using zc.buildout. I can always look at the source, but ideally I'd find a list somewhere, or be able to query buildout to find out what it thinks are the variables available at any one time. Is this possible?
...
I have the following python function to recursively find all partitions of a set:
def partitions(set_):
if not set_:
yield []
return
for i in xrange(2**len(set_)/2):
parts = [set(), set()]
for item in set_:
parts[i&1].add(item)
i >>= 1
for b in partitions(parts[1]):...
I am a new to both Python and Django and I'm learning by creating a diet management site but I've been complete defeated by getting my unit tests to run. All the docs and blogs I've found say that as long as it's discoverable from tests.py, tests.py is in the same folder as models.py and you test class subclasses TestCase it should all ...
I have a Python test suite that creates and deletes many temporary files. Under Windows 7, the shutil.rmtree operations sometimes fail (<1% of the time). The failure is apparently random, not always on the same files, not always in the same way, but it's always on rmtree operations. It seems to be some kind of timing issue. It is als...
I'm planning to build a community-driven website with voting functionality similar to StackOverflow (or Digg etc..). I really like SO's voting system where your points are deducted for voting down someone and so on.
Anyway, is there any open-source module/component available that I can plug into my app directly without having to reinven...
I am currently using Django forms with the Google App Engine and I have a model which is as follows:
class Menu(db.Model):
name = db.StringProperty(required=True)
is_special = db.BooleanProperty()
menu_items = db.ListProperty(MenuItem)
I have a MenuForm which is the following:
class MenuForm(djangoforms.ModelForm):
c...
In other platforms can I develop a service without worrying about addresses and bindings?
What is the name of equivalent technologies for Java, Python and other environments?
Edit:
For those who are unfamiliar with WCF, this is a part of the .NET 3.x framework whose main feature is to enable developing services that can answer multiple ...
Normally, I use IntelliJ for python programming. But sometimes I don't have access to it or just to make a quick edit I open a Python file in a text editor.
At those times, it is really difficult to find the namespace of a class. I am googling it. But it takes time. Is there a better way to do this?
Edit:
Looking at the responses, I n...
I'm trying to build a set of instances of an object, however adding instances of certain objects results in a TypeError: unhashable instance. Here is a minimal example:
from sets import Set
import random
from UserDict import DictMixin
class Item1(object):
pass
class Item2(DictMixin):
pass
item_collection = Set()
x = Item1()
...
Hi,
I call the autocomplete jquery with the result of a GET request.
The autocomplete function call looks like this:
$('#id_project_owner_externally').autocomplete('/pm/contact_autocomplete');
The url /pm/contact_autocomplete returns a list of tuples. The first part of the tuple is the name of the contact and the second part of the ...
I'm trying to write an application which uses Google's protocol buffers to deserialize data (sent from another application using protocol buffers) over a TCP connection. The problem is that it looks as if protocol buffers in Python can only deserialize data from a string. Since TCP doesn't have well-defined message boundaries and one o...