Trying to use pil for creating grid-like layout from images. But that code only draws first column. Can anyone help me?
def draw(self):
image=Image.new("RGB",((IMAGE_SIZE[0]+40)*5+40,(IMAGE_SIZE[1]+20)*CHILD_COUNT+20),(255,255,255))
paste_x=(-1)*IMAGE_SIZE[0]
paste_y=(-1)*IMAGE_SIZE[1]
i=0
for a range(5):
pas...
Hi,
I'm relatively new to Python, but feel like I'm getting a good feel for it. I was wondering what would be some well documented open source projects in Python for beginners.
Sorry if this question is a repeat. I found a few good links mentioned in other threads, but I'm looking for open source projects only in Python (I've heard Twi...
How can I copy a posted file to disk?
Can I do something like:
file = '/uploaded_files/test.txt'
shutil.copy2(request.POST['file'],file)
Thanks.
...
Hello there
i wanted to know if it was possible to make a voip script in python and then if it works integrate it online on my web site
thanks a bunch
...
I'm currently reformatting some HTML pages with BeautifulSoup, and I ran into bit of a problem.
My problem is that the original HTML has things like this:
<li><p>stff</p></li>
and
<li><div><p>Stuff</p></div></li>
as well as
<li><div><p><strong>stff</strong></p></div><li>
With BeautifulSoup I hope to eliminate the div and the ...
I am trying to use ftps to upload file to our FTP server. Login is trivial and works:
from M2Crypto import ftpslib
ftp = ftpslib.FTP_TLS()
ftp.connect(host)
ftp.login(username, password)
as well as descending into directory
for dir in directory:
ftp.cwd(dir)
However, when trying to retrieve directory content:
if directory_name...
I'm using Pylons to upload an image and store it to disk:
<form method="post">
<input type="file" name="picture" enctype="multipart/form-data" />
</form>
Then in my controller:
if 'picture' in request.POST:
i = ImageHandler()
#Returns full path of image file
picture_file = i.makePath()
shutil.copyfileobj(re...
I really like the python coverage module:
http://nedbatchelder.com/code/coverage/
and the HTML pages it generates. Is there a combination of this and profiling so that one could see a unified HTML report of coverage+profiling.
Thanks in advance.
...
I'm developing a simple Python program with a (dynamic) form interface, but it needs to run on Google App Engine. I understand that IronPython lets one use Visual Studio's drag-and-drop interface builder and classes while programming with Python, but will this be compatible with Google App Engine?
...
Hi,
I'm having a hard time getting what I want out of the python subprocess module (which supposed to an unified/platform-independent abstraction, afaik, but don't get me started on that :)).
So the simple thing what I'm after is the following. I want to
Launch an external (stdio) application (possibly with subprocess), where I use s...
I need a way to "inject" names into a function from an outer code block, so they are accessible locally and they don't need to be specifically handled by the function's code (defined as function parameters, loaded from *args etc.)
The simplified scenario: providing a framework within which the users are able to define (with as little sy...
Hi all,
I am making a bookmarklet where I need people to login first. My question is how do I send login credentials to the django server from a different domain?
I was thinking there were a couple ways, since I can't use send data via request.
Generate the sha1 algo on the client-side...but then how do I know what Django is salting ...
I've set up my app.yaml and data_uploader files as suggested in this document. My CSV file has some null values (the spreadsheet that I exported had some empty cells).
When I run the script, I get this error in the log file:
[ERROR ] Error in WorkerThread-0: Value should not be empty; received [].
My guess is that it is because som...
I recently discovered that page object attributes in CherryPy are persistent between requests (and between clients). So I'm wondering, would it make sense to store page output in such an attribute? Like this:
class Page:
def default(self, pagenumber):
if pagenumber not in self.validpages:
return 'Page number not ...
Hello,
What is the correct regex statement using re.search() to find and return a file extension in a string.
Such as:
(.+).(avi|rar|zip|txt)
I need it to search a string and if it contains any of those avi, rar, etc) return just that extension.
Thanks!
EDIT: should add that is needs to be case insensitive
...
I am attempting to create a relatively simple shopping cart in Django. I am storing the cart in request.session['cart']. Therefore, I'll need to access the data in this session when anything is added to it. However, if the session is not already set, I cannot access it without receiving an error. Is there anyway to check if a session is ...
main.py:
import subone
import subtwo
subone.py:
a = 'abc'
subtwo.py:
print subone.a
Running python main.py throws a NameError: name 'subone' is not defined. I expected it to print 'abc'.
Refactoring it to use from import and classes doesn't help:
main.py:
from subone import * # Only using from X import * for example purpose...
I want the events to be arbitrary events, for example: "User answered X", "User P sent you a message with Q".
...
For example:
>> print numberFormat(1234)
>> 1,234
Or is there a built-in function in Python that does this?
Thanks!
...
I'm not even sure what sliding average is, but someone told me it would help with something I'm working on.
I have a table of random values -- table[n] = random(100) / 100
I need to populate table2 with their sliding averages.
I think this is the terminology. Let me know if it doesn't make sense.
...