I would like to find out if Twisted imposes restriction on maximum size of UDP packets. The allowable limit on linux platforms is upto 64k (although I intend to send packets of about 10k bytes consisting of JPEG images) but I am not able to send more than approx. 2500 bytes
...
print 'xxx' > 'ssaww'
it print 'true'
who can give me a clear example .
thanks
...
We just started learning about class inheritance and attribute lookup in python. I have a question about the following code:
class a : n = 1
class b : n = 2
class c : n = 3
class d (a,b) : pass
class e (d,c) : pass
I know that e.n would equal 1 due to the nature of attribute lookup procedure (depth first search). However, how would I ...
Hi all,
I written a code for downloading and saving images from a site .It worked nicely,but for some urls it is being showing an error.I have paste code below
import urllib2
import webbrowser
imageurl='http://www.example.com/'+image[s]
opener1 = urllib2.build_opener()
page1=opener1.open(imageurl)
my_picture=page1.read()
image1=image[...
I'm running python 2.6 on an Intel Mac OS X 10.5
I'm trying to install pycurl 7.16.2.1 (as recommended here http://curl.haxx.se/mail/curlpython-2009-03/0009.html), but for some reason, the installation sees my libcurl 7.16.3, yet it still insist I install 7.16.2 or greater (doesn't 7.16.3 satisfy that?)
Here's the error output:
Runnin...
I have two large identical-sized files. One is ASCII plain text, and the other is a colour-coded overlay, one byte per text character in the corresponding file.
These files can be large - upto 2.5 MB; possibly substantially more, perhaps over 100MB later.
I want to display the text is a scrollable text viewer, using the second file as...
I just started working on a website that is full of pages with all their HTML on a single line, which is a real pain to read and work with. I'm looking for a tool (preferably a Python library) that will take HTML input and return the same HTML unchanged, except for adding linebreaks and appropriate indentation. (All tags, markup, and c...
I've tried to implement function composition with nice syntax and here is what I've got:
from functools import partial
class _compfunc(partial):
def __lshift__(self, y):
f = lambda *args, **kwargs: self.func(y(*args, **kwargs))
return _compfunc(f)
def __rshift__(self, y):
f = lambda *args, **kwargs: y(...
I'm working with a Netbeans for Python development, I have a number of projects (which have a number of modules). What I basically want to know is, how do I import one of these modules into a new project? I have tried editing the python path in netbeans, but to no avail. Here's my setup:
Netbeans projects
=================
ProjectA
...
The particular alias I'm looking to "class up" into a Python script happens to be one that makes use of the cUrl -o (output to file) option. I suppose I could as easily turn it into a BASH function, but someone advised me that I could avoid the quirks and pitfalls of the different versions and "flavors" of BASH by taking my ideas and mak...
i have two functions one that builds path to set of files and another that reads the files the function as below
def pass_file_name(self):
self.log_files= []
file_name = self.path+"\\access_"+self.appliacation+".log"
if os.path.isfile(file_name):
self.log_files.append(file_name)
for i in xrange(7):
fil...
I've got a problem... we're writing project using django, and i'm trying to use django.test.client with nose test-framework for tests.
Our code is like this:
from simplejson import loads
from urlparse import urljoin
from django.test.client import Client
TEST_URL = "http://smakly.localhost:9090/"
def test_register():
cln = Clien...
I have a lot of model classes with ralations between them with a CRUD interface to edit. The problem is that some objects can't be deleted since there are other objects refering to them. Sometimes I can setup ON DELETE rule to handle this case, but in most cases I don't want automatic deletion of related objects till they are unbound man...
Hi,
I'm learning python for the first time.
I have an aim which is to take data from an API and output it as xml.
The output is stored in an array ("projectData"), here is an example of the output:
[{'code': 'demo',
'created_at': datetime.datetime(2008, 6, 11, 7, 35, 19, tzinfo=<api.LocalTimezone object at 0x10072ab10>),
'created_by...
Hey, I just started wondering about this as I came upon a code that expected an object with a certain set of attributes (but with no specification of what type this object should be).
One solution would be to create a new class that has the attributes the code expects, but as I call other code that also needs objects with (other) attrib...
Question: Could people show or point me a complete example or tutorial to start using Beaker in Django?
Information:
Since I've read about problem in database connection with django orm
from here.
http://lethain.com/entry/2008/jul/23/replacing-django-s-orm-with-sqlalchemy/
Here is the correct link http://adam.gomaa.us/blog/2007/aug/26...
I'm working on a project where all the code in the source tree is separated into module directories, e.g.:
modules/check/lib/check.py
modules/edit/lib/edit.py
During installation, the Python files are put in the same directory program_name under Python's site-packages. All the modules therefore use the syntax import program_name.edit....
I'm using following model to store info about pages:
class Page(models.Model):
title = models.TextField(blank = False, null = False)
New data saves correctly, I'm saving Unicode data there (lots of non-ASCII titles).
But when I'm performing query:
page = Page.objects.filter(id = 1)
page.title looks odd:
u'\u042e\u0449\u0435\u0...
Is there a situation where the use of a list leads to an error, and you must use a tuple instead?
I know something about the properties of both tuples and lists, but not enough to find out the answer to this question. If the question would be the other way around, it would be that lists can be adjusted but tuples don't.
...
Hello,
I am trying to store some parsed feed contents values in Sqlite database table in python.But facing error.Could anybody help me out of this issue.Infact it is so trivial question to ask!I am newbie!..Anyway thanks in advance!
from sqlite3 import *
import feedparser
data = feedparser.parse("some url")
conn = connect('location.d...