I'm working on a python application and have chosen to build the gui with PythonCard. I have need to have the user select a file to open, and in the context, selecting more than 1 file doesn't make sense. I can successfully create a file dioalog with
dialog.fileDialog(self, 'Open Input File', '', '')
And I would imagine I need to us...
I'm trying to write a POS-style application for a Sheevaplug that does the following:
Captures input from a card reader (as I understand, most mag card readers emulate keyboard input, so basically I'm looking to capture that)
Doesn't require X
Runs in the background (daemon)
I've seen examples of code that will wait for STDIN, but th...
Hi,
I am studying some examples in a tutorial where there are a lot of leading >>> characters and ellipsis in the text. This makes it hard to cut and paste into the IPython interpreter since it doesn't like these strings.
Is there another interpreter I could use that will appropriately ignore and interpret these leading terms?
For exa...
The following code:
gb = self.request.form['groupby']
typ = self.request.form['type']
tbl = self.request.form['table']
primary = self.request.form.get('primary', None)
if primary is not None:
create = False
else:
create = True
mdb = tempfile.NamedTemporaryFile()
mdb.write(self.request.form['mdb'].read())
mdb.seek(0)
csv = tempfi...
Given:
def test_to_check_exception_is_thrown(self):
# Arrange
c = Class()
# Act and Assert
self.failUnlessRaises(NameError, c.do_something)
If do_something throws an exception the test passes.
But I have a property, and when I replace c.do_something with c.name = "Name" I get an error about my Test Module not being im...
I am having a problem figuring out how to solve this problem the Django and (probably) the Python way. I am sending a hash to a template that contains the following values
{'date': '2009-12-30', 'locations': [{u'lat': 43.514000000000003, u'lng': -79.844032999999996, u'place': u'1053 Bowring Cres, Milton, ON L9T, CA', u'description': u'...
I'm trying to insert a String into a list.
I got this error:
TypeError: can only concatenate list (not "tuple") to list
because I tried this:
var1 = 'ThisIsAString' # My string I want to insert in the following list
file_content = open('myfile.txt').readlines()
new_line_insert = file_content[:10] + list(var1) + rss_xml[11:]
open('my...
Any function in that Graphviz which can do that?
If not, any other free software that can do that?
...
I am profiling my twisted server. It uses much more memory than I expected. Its memory usage grows over time.
ps -o pid,rss,vsz,sz,size,command
PID RSS VSZ SZ SZ COMMAND
7697 70856 102176 25544 88320 twistd -y broadcast.tac
As you can see it costs 102176 KBs, namely, 99.78125 MBs. And I use guppy from a twisted manhole ...
I'm using PyRSS2Gen to generate an RSS feed. I've succeeded in extending it to add an extra element to each item in the RSS feed:
class FullRSSItem(PyRSS2Gen.RSSItem):
def __init__(self, **kwargs):
if 'content' in kwargs:
self.content = kwargs['content']
del kwargs['content']
else:
...
I'm really confused by some errors I'm getting as I'm trying to put an App into production. Everything works fine on the development machine, but I can't syncdb or enter the Django shell on the Production server.
I'm getting an error when forum.models.py is attempts to import forum.managers.py because the models aren't in the namespace y...
How to disable individual tests temporarily using unittest module in python?
Like googletest does.
Thanks.
...
While I've written unit tests for most of the code I've done, I only recently got my hands on a copy of TDD by example by Kent Beck. I have always regretted certain design decisions I made since they prevented the application from being 'testable'. I read through the book and while some of it looks alien, I felt that I could manage it an...
I like Python's whitespace formatting and legibility. But can you, or is there a common/standard way of delimiting blocks of code that are not to be indented, ie do not belong in nested loops?
I have two parts of a procedure that belong inside a main header. Something like step 2 has parts 2.1 and parts 2.2.
Commenting so far I have so...
I am using PyGTK to build a GUI application. I want to update the textview widget from another thread but the widget is not getting updated everytime i try an update. What should i do to get a reliable GUI updating?
...
Hello, I want to create a dynamic image with python.
There are three panels in the frame, title panel, image panel, and information panel. The image changes dynamically in the image panel. I use the OnTimer to update the image. There are two OnTimer, one in image panel, and the other in main frame. The OnTimer() in main frame will call t...
I'm writing a client/server application in Python and I'm finding it necessary to get a new connection to the server for each request from the client. My server is just inheriting from TCPServer and I'm inheriting from BaseRequestHandler to do my processing. I'm not calling self.request.close() anywhere in the handler, but somehow the se...
My view code looks basically like this:
context = Context()
context['my_dict'] = {'a': 4, 'b': 8, 'c', 15, 'd': 16, 'e': 23, 'f': 42 }
context['my_list'] = ['d', 'f', 'e', 'b', 'c', 'a']
And what I'd like to do in my Django template is this:
<ul>
{% for item in my_list %}
<li>{{ item }} : {{ my_dict.item }}</li>
{% endfor %}
</u...
My view code looks basically like this:
context = Context()
context['some_values'] = ['a', 'b', 'c', 'd', 'e', 'f']
context['other_values'] = [4, 8, 15, 16, 23, 42]
I would like my template code to look like this:
{% for some in some_values %}
{% with index as forloop.counter0 %}
{{ some }} : {{ other_values.index }} <br/>
...
Hello
I am looking to seasonally adjust monthly data, using Python. As you can see from these series: www.emconfidential.com, there is a high seasonal component to the data. I would like to adjust for this so that I can better guage if the series trend is rising or falling. Anybody know how to do this easily using scipy or other Pytho...