If I run the following in python in Ubuntu 10.04:
>>> import pynotify
>>> p = pynotify.Notification ("Notice","","/home/george/Pictures/test.png")
>>> p.show()
true
The message displays as expected, except the image does not appear in the OSD. How can I display a local image?
In fact, for what I need, it would be better if I could di...
Suppose I have a list of lists of elements which are all the same (i'll use ints in this example)
[range(100)[::4], range(100)[::3], range(100)[::2], range(100)[::1]]
What would be a nice and/or efficient way to take the intersection of these lists (so you would get every element that is in each of the lists)?
For the example that wou...
I'm trying to write a simple socket-based client in Python that will connect to a telnet server. I can test the server by telnetting to its port (5007), and entering text. It responds with a NAK (error) or an AK (success), sometimes accompanied by other text. Seems very simple.
I wrote a client to connect and communicate with the ser...
One of the major strengths of python and a few other (functional) programming languages are the list comprehension. They allow programmers to write complex expressions in 1 line. They may be confusing at first but if one gets used to the syntax, it is much better than nested complicated for loops.
With that said, please share with me ...
I have the following functions for colorizing my screen messages:
def error(string):
return '\033[31;1m' + string + '\033[0m'
def standout(string):
return '\033[34;1m' + string + '\033[0m'
I use them as follows:
print error('There was a problem with the program')
print "This is normal " + standout("and this stands out")
I ...
i want to know what is a pyc file(python bytecode) i want to know all details,
i want to know about the compiler,
is it a replacement for exe?
does it need to be run by python?
is it as portable as .py file is?
where sould i use this?
tnx
...
I want to use some packages (i.e., IPython or zdaemon), butI am doing this on a system (my university) that does not give me permissions for /usr/local, /usr/bin, or all these directories. Is there a way around it?
...
I've encountered several situations when using MongoDB that require the use of DBRefs. However, I'd also like to cache some fields from the referenced document in the DBRef itself.
{$ref:'user', $id:'10285102912A', username:'Soviut'}
For example, I may want to have the username available even though the user document is referenced. ...
What am I doing wrong/what can I do?
import sys
import string
def remove(file):
punctuation = string.punctuation
for ch in file:
if len(ch) > 1:
print('error - ch is larger than 1 --| {0} |--'.format(ch))
if ch in punctuation:
ch = ' '
return ch
else:
retur...
I'm using the admin interface to view invoices and products. To make things easy, I've set the products as inline to invoices, so I will see the related products in the invoice's form. As you can see I'm using a many-to-many relationship.
In models.py:
class Product(models.Model):
name = models.TextField()
price = models.Deci...
Possible Duplicates:
Fast technology to learn
How to learn programming related topics faster?
What is the fastest way to learn a new programming Language? I've heard of a few programmers that know 5-6 programming languages fluently, how do they do that? Just looking for tips and tricks really? Any advice?
Thanks in advance;...
I am writing a python script which looks at common computer files and examines them for similar bytes, words, double word's. Though I need/want to see the files in Hex, ande cannot really seem to get python to open a simple file in python. I have tried codecs.open with hex as the encoding, but when I operate on the file descriptor it a...
scenario: a modular app that loads .py modules on the fly as it works. programmer (me) wishes to edit the code of a module and and then re-load it into the program without halting execution.
can this be done?
i have tried running import a second time on an updated module.py, but the changes are not picked up
...
Hi,
I have a question about the loop construct in Python in the form of: for x in y: In my case y is a line read from a file and x is separate characters. I would like to put a space after every pair of characters in the output, like this: aa bb cc dd etc. So, I would like to know the current iteration. Is it possible, or do I need to u...
I've been developing a Django app for weeks locally on OSX 10.6.3. Recently, I rebooted my machine and went to start my development environment up.
Here's the error:
cm:myApp cm$ python manage.py runserver
Traceback (most recent call last):
File "manage.py", line 11, in execute_manager(settings)
File "/Library/Python/2.6/...
when i upload my project to google-app-engine , it show this :
Error: Server Error
The server encountered an error and could not complete your request.
If the problem persists, please report your problem and mention this error message and the query that caused it.
why ?
how can i debug this error ?
thanks
...
Seems it hasn't been updated in a while, and lacks support for things like sy:updateFrequency.
...
I want to automate the process of plone3_buildout.
Explanation:
The default(the one I use) way of building a plone site is using paster, like so:
paster create -t plone3_buildout
This asks me a few questions and then create a default buildout for the site.
What I want:
I want to automate this process using buildout. My buildout will...
#modules
import sys
import string
#Importing and reading the files form the Command Prompt
#Document = open(sys.argv[1],"r")
Document = open('Wc.txt', 'r')
Document = Document.read().lower()
#Dictionary = open(sys.argv[2],"r")
Dictionary = open('Dict.txt', 'r')
Dictionary = Dictionary.read()
def Format(Infile):
for ch in string.pu...
i have this piece of code
the last bit of the code starting from d = {}
im trying to print the words with its line number located in the text but it is not working its only printing the words anyone know why ???
need help ASAP
import sys
import string
text = []
infile = open(sys.argv[1], 'r').read()
for punct in string.punctuation:
...