I'm sooo close... but I don't quite see the connection from the upload view to the model. When I use the callback in the model's FileField the upload works, but I'm not sure where the actual file copy is taking place. The goal is to make sure that chunking is happening, but the file copy action seems to be hidden somewhere?
Here's what ...
Hi,
Python crashes while using the "import nltk" command. All other import commands word. Tried re-installing with various sequences but couldn't resolve the issue.
Python version: 2.6.5
NLTK version: 2.0b8
Following packages/libraries installed:
PyYAML
NumPy
SciPy
Matplotlib
easy_install
Regards,
--Denzil
...
In python if you write something like
foo==bar and spam or eggs
python appears to return spam if the boolean statement is true and eggs otherwise. Could someone explain this behaviour? Why is the expression not being evaluated like one long boolean?
Edit: Specifically, I'm trying to figure out the mechanism why 'spam' or 'eggs' is be...
I'm trying to upload an image (just a random picture for now) to my MediaWiki site, but I keep getting this error:
"Unrecognized value for parameter 'action': upload"
Here's what I did (site url and password changed):
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "cop...
I am currently working on getting JavaScript to execute successfully from within Python. I have implemented a JS engine (v8) using the PyV8 package. From here I can execute primitive JavaScript ("1+2", etc). However, for JavaScript that uses references to "document" or "window" the code will throw an error. I am looking, ideally, for a P...
I want to cache some results in my OpenERP module, so I dug around a bit and found the cache decorator. Unfortunately, the most documentation I've been able to find is in the class declaration:
Use it as a decorator of the function you plan to cache Timeout: 0 = no timeout, otherwise in seconds
Can anybody recommend a good example ...
How do I go about creating a list of objects (class instance) in Python?
Or is this a result of bad design? I need this cause I have different objects and I need to handle them at a later stage, so I would just keep on adding them to a list and call them later.
...
I have a top level widget that is created when a button is pressed. How do I make it so when that same button is pressed again, while the top level widget is still open it simply moves the top level widget into focus?
...
I need to filter geocodes for near-ness to a location. For example, I want to filter a list of restaurant geocodes to identify those restaurants within 10 miles of my current location.
Can someone point me to a function that will convert a distance into latitude & longitude deltas? For example:
class GeoCode(object):
"""Simple cl...
I'm using Boost.Python to wrap a C++ library.
How do I ensure that the same Python instance (by object identity) is always returned for a particular C++ instance (by pointer identity)? I can't extend the C++ classes, but I can add a member variable (such as a PyObject * or a boost::python::handle<>) if that helps. I'm thinking that I sh...
How do I detect what language a text is written in using NLTK?
The examples I've seen use nltk.detect, but when I've installed it on my mac, I cannot find this package.
Cheers
Nik
...
I can't get this to work... what could be the problem?
import flickrapi
api_key = '1234...'
flickr = flickrapi.FlickrAPI(api_key)
user = '43699959@N02'
favs = flickr.favorites_getPublicList(user_id = user)
>>> favs.items()
[('stat', 'ok')]
>>> favs.text
'\n'
Where are my favorite photo's?
Note: It does work via this testing page:...
I have a Django app on a Linux server. In one of the views, some form of print command is executed, and some string gets printed. How can I find out what the printed string was? Is there some log in which these things are kept?
...
Are there any python modules available for parsing and manipulating symbolic expressions in Python similar to how Lisp expressions are evaluated?
...
I can define an object and assign attributes and methods:
class object:
def __init__(self,a,b):
self.a = a
self.b = b
def add(self):
self.sum = self.a + self.b
def subtr(self):
self.fin = self.sum - self.b
def getpar(self):
return self.fin
obj = object(2,3)
obj.add()
obj.subtr()
o...
I'm getting back from a library what looks to be an incorrect unicode string:
>>> title
u'Sopet\xc3\xb3n'
Now, those two hex escapes there are the UTF-8 encoding for U+00F3 LATIN SMALL LETTER O WITH ACUTE. So far as I understand, a unicode string in Python should have the actual character, not the the UTF-8 encoding for the character...
Is there an article or forum discussion or something somewhere that explains why lists use append/extend but sets and dicts use add/update.
I frequently find myself converting lists into sets and this difference makes that quite tedious so for my personal sanity I'd like to know what the rationalization is.
The need to convert between ...
Hello--
I have a long-running program on a remote machine and want to be sure that (1) I have a record of any exception that causes it to terminate and (2) someone is notified if it terminates. Does anyone see drawbacks to the method I am using? (or have recommendations for a better one?)
I've read the Python docs and many exception-re...
how to shuffle a word's letters randomly in python?
for example, we have the word "cat". change that randomly to, act, tac or tca and ex..
to be exact,The scrambling process must be implemented manually. Built-in functions or string methods that “automate” this process are prohibited from use.
thanks
...
Is there a way to display other language characters in PyQt4?
and if there is, what's the approach/direction that I should take?
Thanks in advance.
...