I am learning Python and PyGTK.
I'm trying to write a Twitter client. Which widget is best suited for displaying the Tweets (Timeline). I can do it easily with textview but it doesn't support sub widgets to display users image.
Tried using TreeView but it seems to be an overkill and is too complex.
I'm using Glade
...
We are working on a .po file editor for translators. And the translators need to see the changes they are doing on the live website.
We managed to reload the .mo files for the current process/thread. but not for every process/thread.
Is there a possibility to accomplish this without bigger performance problems?
...
Hello
I am interfacing with a Java application via Python. I need to be able to construct byte sequences which contain utf-8 strings. Java uses a modified utf-8 encoding in DataInputStream.readUTF() which is not supported by python (yet at least)
Can anybody point me in the right direction to construct java modified utf-8 strings in py...
I need to "flatten" objects into nested dicts of the object's properties. The objects I want to do this with are generally just containers for basic types or other objects which act in a similar way. For example:
class foo(object):
bar = None
baz = None
class spam(object):
eggs = []
x = spam()
y = foo()
y.bar = True
y.baz ...
I'm getting annoyed with the default python syntax highlighting in vim.
it does not highlight the else: statement correctly.
vim only highlights the else statement if i have some white space between the "else" and the colon ":" so this works: "else :" but "else:" does not.
It must be easy to fix..
I'm using vim 7.2
...
Hi, please excuse me for my ugly english ;-)
Imagine this very simple model :
class Photo(models.Model):
image = models.ImageField('Label', upload_to='path/')
I would like to create a Photo from an image URL (i.e., not by hand in the django admin site).
I think that I need to do something like this :
from myapp.models import Ph...
Hi,
my programm starts a subprocess, which has to send some kind of signal to the parent after initialization. It would be perfekt if i could set up a handler in parent, which is called when this signal is sent. Is there any way to do it?
Alendit
...
In Python, when given the URL for a text file, what is the simplest way to access the contents off the text file and print the contents of the file out locally line-by-line without saving a local copy of the text file?
TargetURL=http://www.myhost.com/SomeFile.txt
#read the file
#print first line
#print second line
#etc
...
Hi,
Would you know if something similar to Terracotta (in Java world) exists for Python world? Twisted ? Or something else...
Thank you in advance for all ideas.
...
Hi,
Is there a general naming conventions for configuration files for a simple python program?
Thanks,
Udi
...
I'm not sure how to represent a certain datastructure in Python. It consists of groups and users where each user must be a member of exactly one group and groups should be in turn contained in a container, groups and users will only be used within this container. Furthermore I need random access to groups and users. A JSON representation...
:make provides a list of errors which can be navigated through in order to fix.
The problem is that this script only works in Unix based OSes.
autocmd BufRead *.py set makeprg=python\ -c\ \"import\ py_compile,sys;\ sys.stderr=sys.stdout;\ py_compile.compile(r'%')\"
autocmd BufRead *.py set efm=%C\ %.%#,%A\ \ File\ \"%f\"\\,\ line\ %l%....
In Python, what is the simplest way to execute a local Linux command stored in a string while catching any potential exceptions that are thrown and logging the output of the Linux command and any caught errors to a common log file?
String logfile = “/dev/log”
String cmd = “ls”
#try
#execute cmd sending output to >> logfile
#catch sen...
Hi,
I want to sort a list of dictionaries by dictionary key, where I don't want to distinguish between upper and lower case characters.
dict1 = {'name':'peter','phone':'12355'}
dict2 = {'name':'Paul','phone':'545435'}
dict3 = {'name':'klaus','phone':'55345'}
dict4 = {'name':'Krishna','phone':'12345'}
dict5 = {'name':'Ali','phone':'5345...
I'm writing a SWIG wrapper around a custom C++ library which defines its own C++ exception types. The library's exception types are richer and more specific than standard exceptions. (For example, one class represents parse errors and has a collection of line numbers.) How do I propagate those exceptions back to Python while preserving t...
I need to copy a remote image (for example http://site.com/image.jpg) to my server. Is this possible?
How do you verify that this is indeed an image?
...
My day job is mainly coding in vb.net, so I am very familiar with it. While doing my first few dozen project euler problems, I used vb.net just to get the hang of the problem styles. Now I'd like to use project euler to help me learn a new language and have been running a couple in python. However. I've hit a snag.
The following code...
How would I do a "hit any key" (or grab a menu option) in Python?
raw_input requires you hit return.
Windows msvcrt has getch() and getche().
Is there a portable way to do this using the standard libs?
...
I want to create a SQL interface on top of a non-relational data store. Non-relational data store, but it makes sense to access the data in a relational manner.
I am looking into using ANTLR to produce an AST that represents the SQL as a relational algebra expression. Then return data by evaluating/walking the tree.
I have never implem...
What does the "b" stand for in the output of bin(30): "0b11110". Is there any way I can get rid of this "b". How can I get the output of bin() to always return a standard 8 digit output?
Thank you,
...