I'd like to start creating unit tests for my Maya scripts. These scripts must be run inside the Maya environment and rely on the maya.cmds module namespace.
How can I run Nose tests from inside a running environment such as Maya?
...
Is it possible to use create_object view to create a new object and automatically asign request.user as foreign key?
P.E:
class Post(models.Model):
text = models.TextField()
author = models.ForeignKey(User)
What I want is to use create_object and fill author with request.user.
...
I have a large object I'd like to serialize to disk. I'm finding marshal works quite well and is nice and fast.
Right now I'm creating my large object then calling marshal.dump . I'd like to avoid holding the large object in memory if possible - I'd like to dump it incrementally as I build it. Is that possible?
The object is fairly si...
Our Python CMS stores some date values in a generic "attribute" table's varchar column. Some of these dates are later moved into a table with an actual date column. If the CMS user entered an invalid date, it doesn't get caught until the migration, when the query fails with an "Invalid string date" error.
How can I use Python to make ...
I have a zip file which contains the following directory structure:
dir1\dir2\dir3a
dir1\dir2\dir3b
I'm trying to unzip it and maintain the directory structure however I get the error:
IOError: [Errno 2] No such file or directory: 'C:\\\projects\\\testFolder\\\subdir\\\unzip.exe'
where testFolder is dir1 above and subdir is dir2.
...
I'm trying to handle a bunch of files, and I need to alter then to remove extraneous information in the filenames; notably, I'm trying to remove text inside parentheses. For example:
filename = "Example_file_(extra_descriptor).ext"
and I want to regex a whole bunch of files where the parenthetical expression might be in the middle or ...
I love the Beautiful Soup scraping library in Python. It just works. Is there a close equivalent in Ruby?
...
I've heard ubuntu 9.4 will but it's still in alpha. Are there any stable distros that come with python 2.6 or at least don't depend on it so much so reinstalling python won't break anything?
...
Is it possible to override the html naming of fields in TabularInline admin forms so they won't contain dashes?
I'm trying to apply the knowledge obtained here to create a TabularInline admin form that has the auto-complete feature.
It all works except that Django insists in naming the fields in a tabularinline queryset as something in...
I want to create a simple file upload form and I must be completely incapable. I've read docs and tutorials,but for some reason, I'm not getting the submitted form data. I wrote the smallest amount of code I could to test and it still isn't working. Any ideas what's wrong?
def index():
html = '''
<html>
<body>
<form ...
How can you tell whether python has been started with the -i flag?
According to the docs, you can check the PYTHONINSPECT variable in os.environ, which is the equivalent of -i. But apparently it doesn't work the same way.
Works:
$ PYTHONINSPECT=1 python -c 'import os; print os.environ["PYTHONINSPECT"]'
Doesn't work:
$ python -i -c ...
The following code
import types
class A:
class D:
pass
class C:
pass
for d in dir(A):
if type(eval('A.'+d)) is types.ClassType:
print d
outputs
C
D
How do I get it to output in the order in which these classes were defined in the code? I.e.
D
C
Is there any way other than using inspect.getsour...
Hi,
On the flex side i have a tree component which gets his Tree data from the backend.
On the backend side we have Django using Pyamf for communication with Flex.
We use MPTT (Modified Preorder Tree Traversal) Dango app to store Categories in a tree like fashion (a category Class has a parent field). We also have an Item Model Class w...
Google app engine question: What is a good way to take formatted text (does not have to be rich text) from the user and then store it in a text or blog property in the datastore? Mainly what I'm looking for is it to store newlines and strings of spaces, so that the text comes back looking the same as when it was submitted.
...
How do I write to the serial port in Vista from Python? The termios package only seem to support posix.
...
Django is my favorite python web framework. I've tried out others like pylons, web2py, nevow and others.
But I've never looked into TurboGears with much enthusiasm.
Now with TG2 out of beta I may give it a try. I'd like to know what are some of the pros and cons compared to Django.
...
I was wondering if someone could help me out. In some web application, the app will send out emails, say when a new message has been posted. Then instead of signing into the application to post a reply you can just simply reply to the email and it will automatically update the web app with your response.
My question is, how is this do...
I have installed the newest iPython in Mac. However, it uses the Python verion 2.5.1.
I installed the Python 2.6.1 by MacPython package at here.
How can I make my iPython to use Python 2.6.1?
I am not sure where the MacPython package exactly installed the newest Python.
The newest Python should somehow put the PATH so that iPyhon can...
This works, partially. More information may be needed, however, I thought I would post to get advice on anything obvious that might be wrong here.
The problem is that if activity.get_cost() returns a False value, the function seems to exit entirely, returning None.
What I'd like it to do, of course, is accumulate cost Decimal values i...
Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 multiprocessing module. Because it uses multiprocessing, there is module-level multiprocessing-aware log, LOG = multiprocessing.get_logger(). Per the docs, this logger has process-shared locks so that you don't garble things up in sys.std...