When I attempt to connect to one of our internal servers using paramiko (inside of fabric, for what it's worth) I get this error:
Retrieving packages from server p-websvr-004
[p-websvr-004] run: /usr/sbin/pkg_info -aD|grep "Information for"
starting thread (client mode): 0x179f090L
Banner: -----------------------------------------------...
Hi I have a large file that I want to delete the lines that contain the text ALL and print the file without spaces with just the remaining lines. I started a program
sourcefile = open('C:\\scoresfinal.txt', 'r')
filename2 = open('C:\\nohet.txt', 'w')
offending = ["HET"]
def fixup( filename ):
fin = open( filename )
fout = op...
I have been trying to migrate away from pysqlite to apsw but I can't
find a way to reproduce its row_factory function.
this is my original code:
connection = sqlite3.connect("db.db3")
connection.row_factory = sqlite3.Row
cursor = connection.cursor()
and I use it like this:
query = """ SELECT wbcode, Year, """+query_name+"""
...
I'm switching our testing environment from Nose to py.test for testing a Turbogears2 web application.
Currently, when Nose runs it gathers information from a testing configuration file (test.ini) that holds all the testing variables the application needs. And it seems to do so in an automatic way (I'm simply running nosetests and everyt...
I have a python script that successfully loads a csv file into a 2d numpy array and which then successfully extracts the value of a desired cell based on its column and row header values. For diagnostic purposes, I have the script print the contents of the data matrix before it is put into a numpy array. The script works when the data ...
I am doing some animated plotting and using the the matplotlib examples as a guideline. matplotlib examples
With the following linked example from that page the animation has some obvious problems when the frame is resized. What is the correct or best way to deal with this? animation_blit_wx.py
Thanks
...
i want to create a widget depending on the class of the object, is there a simple way to do that in mako? for example
class A might have attributes A and B
while
class B might have attributes A, B and C
is there a pattern for this?
i want to make a super class that they but inherit, but if I have a function print and call it by cal...
Hi all... I'm trying to wrap my brain around this but it's not flexible enough.
In my Python script I have a dictionary of dictionaries of lists. (Actually it gets a little deeper but that level is not involved in this question.) I want to flatten all this into one long list, throwing away all the dictionary keys.
Thus I want to transf...
I'm trying to follow the info I can find about subprocess.Popen as I want to make a linux command line call.. I am trying as below but am getting the error "[Errno 2] No such file or directory". I'm not trying to open a file so I don't understand this error, and it works fine (although with other issues relating to waiting for the proce...
I have the following code:
from Tkinter import *
master = Tk()
canvas = Canvas(master, width=640, height=480, bd=0)
canvas.pack()
line_coords = (3, 3, 3, 100)
canvas.create_line(*line_coords, fill='red')
mainloop()
This will draw a line in the top-left corner. Why is it that if I change line_coords to (2, 2, 2, 100) the line does n...
I have a the string 'Hello', I need to find out what characters occupy which indexes.
Pseudo-code:
string = 'Hello'
a = string.index(0)
b = string.index(4)
print a , b
a would be 'H' and b would be 'o'.
...
How do I specify a range of unicode characters from ' ' (space) to \u00D7FF?
I have a regular expression like r'[\u0020-\u00D7FF]' and it won't compile saying that it's a bad range. I am new to Unicode regular expressions so I haven't had this problem before.
Is there a way to make this compile or a regular expression that I'm forgett...
I'm currently producing PDFs using python and PyQT.
I'd like to change the "Producer" value of the PDF's document information, currently it is set to "Qt 4.6.2 (C) 2010 Nokia Corporation and/or its subsidiary(-ies)".
I've looked through the QPrinter reference, and nothing obvious stuck out that I could set.
How do I change the docum...
I have a Toplevel widget I'd like it so that it would never appear within the confines of the main Tk window. Basically so that when the Toplevel appears it doesn't cover up any of the main Tk window.
...
Can I use Python to develop extensions for all major browsers?
If not then what languages will I need to know to develop extensions for:
Chrome
Firefox
Safari
IE
Opera
...
Hi,
I have tokenized names (strings), with the tokens separated by underscores, which will always contain a "side" token by the value of M, L, or R.
The presence of that value is guaranteed to be unique (no repetitions or dangers that other tokens might get similar values).
In example:
foo_M_bar_type
foo_R_bar_type
foo_L_bar_type
I'...
I've written a function which opens a vim editor with the given filename when called.. How can I do the unittest of these types of operations....
...
I have a Tkinter window whenever the minimize button is pressed I'd like to run a command, how do I do this?
I know w.protocol("WM_DELETE_WINDOW", w.command) will run a command on exit.
...
Our website gets updated almost everyday. We need to update the sitemap to the google webmasters every time there are new pages added.
We have tried using ping_google() along with the required set of arguments and google and it never seem to update the sitemap on webmasters. To log the response, we re-wrote the function and logged the ...
I understand I can set a global function pointer inside a sharef library to point to a python function as follows.
from ctypes import *
liblibrary = cdll.LoadLibrary('liblibrary.so')
def py_library_hook(strings, n):
return 0
# First argument to CFUNCTYPE is the return type:
LIBRARY_HOOK_FUNC = CFUNCTYPE(c_int, POINTER(c_char_p), ...