text stringlengths 226 34.5k |
|---|
Python Pandas: how to turn a DataFrame with "factors" into a design matrix for linear regression?
Question: If memory servies me, in R there is a data type called factor which when used
within a DataFrame can be automatically unpacked into the necessary columns of
a regression design matrix. For example, a factor conta... |
Using django to run python scripts with password arguments
Question: I need to create a web interface that will prompt for a username, password,
and "record id" to run a separate python script using those credentials, and
then spit back a generated file.
The separate script I wrote takes a username/password (and ID) t... |
post-ing a file using python requests and json
Question: I've been given the following curl command as part of API documentation, and
I'm trying to implement it using the requests library.
curl -v --cookie cookie.txt -X POST -H 'Accept: application/json' -F 'spot[photo]'[email protected] -F 'spot[description]'... |
Django Multi-table Inheritance, Django-model-utils errors
Question: I am working on a hobby project for my garage shop. I was directed to django-
model-utils for what I need. (I have serial CNC machines, serial machines have
two flow control methods)
I have a parent class of SerialMachine (defines address, baud rate, ... |
Python BeautifulSoup double question mark in xml definition
Question: I thought it must be a bug so i issued a bug report
[here](https://bugs.launchpad.net/beautifulsoup/+bug/984258). On the other
hand i might be missing something so i need another look on the code.
The problem is, when i initialize BeautifulSoup with... |
Using Global variables in Threads in Python
Question: I am in a situation where i want to put a thread in a loop depending on a
variable which is being changed in one of the called function in the
thread.Here is what i want.
error= 0
while( error = 0)
run_thread = threading.Thread(target... |
Send bash environment variable back to python fabric
Question: I am attempting to pass a bash environment variable back into my fabric
function like this:-
from fabric.api import env
def env_localhost():
"All the environment variables relating to your localhost"
project_home = lo... |
C# .NET interoperabillity with managed Python (CPython) -> any problems?
Question: I am working on a design of an application. The Core should be written in C#
but i also want to use some already finished CPython modules (un-managed).
So I am interested in the interoperability (Call CPython method from C# and
Call C# ... |
python compare words
Question: I have stuck with following problem: I am trying to get subject and compare
from email (it's saved on disk, email in UTF-8)
import re
def check_subj():
subj = ""
file = open("/home/hikaru/Desktop/sub.eml", "r")
for line in file:
... |
Basic indentation - Python
Question:
#RockPS
import random
Choices=['R','P','S']
UserScore=0
CpuScore=0
Games=0
while Games<6:
UserChoice=input('Rock, paper or scissors? (Type R, P or S respectively)')
if UserChoice in Choices:
Games+=1
CpuChoice = ... |
python string to function: globals() vs sys.module vs dictionary
Question: I want to know what is the best way to map the string to a function. so far I
know I can use:
1. globals()[func_string]
2. sys.modules[__name__]
3. funcs_dictionary["func_string" : func]
Here is the code:
>>> def foo(a... |
Can't close Excel completely using win32com on Python
Question: This is my code, and I found many answers for
[VBA](http://en.wikipedia.org/wiki/Visual_Basic_for_Applications), .NET
framework and is pretty strange. When I execute this, Excel closes.
from win32com.client import DispatchEx
excel = Disp... |
How Do I Read a Multi-line File of JSON and Count Words in Specific Field in Python
Question: I have a file with many hundreds of lines of json encoded tweets pulled from
python-tweetstreamer. The lines look like:
{"favorited": false, "in_reply_to_user_id": null, "contributors": null, "truncated": false,... |
Python TypeError when building query string
Question: I am building a query string.
query = "SELECT seqid, date, name, steamid, team, text, type, '%s' as triggerword, '%s' as weight FROM chatlogs WHERE date > '%s' AND text LIKE '%%%s%%' ORDER BY DATE" % (word, weight, self.setting['LAST_RUN_TIME'], word)... |
Python UDF for piglatin script not finding re module
Question: I'm having trouble creating a UDF for a piglatin script I'm using. My problem
is that when I run the script with `pig script.pig` I get the following error:
[main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1121: Python Error. Traceback (... |
subprocess: PyDev console vs. cmd.exe
Question: I'm trying to call a process from python using subprocess.call as shown below:
from subprocess import call
exePath = 'C:\\Test\\EXE.exe'
inPath = 'C:\\Test\\IN.in'
outPath = 'C:\\Test\\OUT.out'
call([exePath, inPath, outPath])
Thi... |
copy function in class definition in python
Question: Im doing a class for polynomial and i have a problem with a copy function. It
suppose to create a copy of the Poly object and return a reference to the new
Poly object. Im really stuck on this copy idea. Thanks for any help
class Poly:
de... |
What's the best way to load large JSON lists in Python?
Question: I have access to a set of files (around 80-800mb each). Unfortunately, there's
only one line in every file. The line contains exactly one JSON object (a list
of lists). What's the best way to load and parse it into smaller JSON objects?
Answer: There i... |
Access information of containing list in python
Question: I'm writing a script that can help me documenting our network rooms.
The idea behind that script is that a room is a list, that contains several
lists for the racks. The rack lists contain lists called module with the
servers/switches/etc. in the module list ar... |
Determine which version of OpenCV
Question: I want to write to short code snippet in python, to determine which version of
OpenCV has been installed in my System. How do i do it ? Thank you.
Answer:
>>> from cv2 import __version__
>>> __version__
'$Rev: 4557 $'
If that doesn't work then, use `cv` i... |
python beginner - faster way to find and replace in large file?
Question: I have a file of about 100 million lines in which I want to replace text with
alternate text stored in a tab-delimited file. The code that I have works, but
is taking about an hour to process the first 70K lines.In trying to
incrementally advance... |
Python writing results out to a file
Question: I have the following script which thanks to the help of everyone is almost
done as it now prints out the results to the screen. I am also looking to add
one more step which will take this same screen output and dump it to a text
file.
I thought this was done with `file.wr... |
checking shared libraries for non default loaders
Question: `ldd` is a good simple way to check for shared libraries a given executable is
or will be using. However it does not always work as expected. For example,
see the following shell snippet that demonstrates how it "fails" to found the
libreadline "dependency" in... |
Python - getting text from html
Question: How to extract text 'ROYAL PYTHON' from this html code in a nice way? I've
been looking for the solution for 4hours and I haven't found anything really
relevant and working.
<div class="definicja"><a href="javascript: void(0);"
onclick="play('/mp3/1/81/c5ebfe... |
How to create an ICMP traceroute in Python
Question: I am trying to implement an ICMP based Traceroute in Python.
I found a very helpful guide (
<https://blogs.oracle.com/ksplice/entry/learning_by_doing_writing_your> ) that
has allowed me to create a UDP based Traceroute (code below) so just needs
modification. I have... |
Unexpected whitespace in python generated strings
Question: I am using Python to generate an ASCII file composed of very long lines. This
is one example line (let's say line 100 in the file, '[...]' are added by me
to shorten the line):
{6 1,14 1,[...],264 1,270 2,274 2,[...],478 1,479 8,485 1,[...]}
... |
Django admin page missing styling when deployed on Apache
Question: I deployed my Django project on Apache but when I navigate to the admin page,
it doesn't seem to have the same formatting as the test server that is
included with Django. I have tinkered around with the configurations and soft
links quite a bit but hav... |
How to set default PS1 value for interactive python?
Question: I'm attempting to colorize my python interpreter to help visually separate
text noise. So if I start interactive python it gives me plain text. I can do
this:
import sys
sys.ps1 = "\033[0;34m>>> \033[0m"
sys.ps2 = "\033[1;34m... ... |
Modifying python programs (python 2.7)
Question: I have a question concerning coding in python for a homework assignment, but I
need to mention first that I've never coded in python before. The assignment
is supposed to get us used to basics, so apologies ahead of time for the lack
of knowledge (and really long post).
... |
BeautifulSoup incorrectly parses page and doesn't find links
Question: Here is a simple code in python 2.7.2, which fetches site and gets all links
from given site:
import urllib2
from bs4 import BeautifulSoup
def getAllLinks(url):
response = urllib2.urlopen(url)
content = re... |
Python: Use lru_cache on lambda function, or other ways to create cache for lambda function
Question: Is there anyway to make it work?
func=i_want_it_to_cache_everything(lambda a,b:a+b)
And it **has to be done in one line**...
Update2:
I figured out the solution (thanks to everyone who replied!).... |
Python- Import Multiple Files to a single .csv file
Question: I have 125 data files containing two columns and 21 rows of data and I'd like
to import them into a single .csv file (as 125 pairs of columns and only 21
rows). This is what my data files look like:
, os.path.pardir)))
import my_module.ext
print sys.path
print dir(my... |
Converting malloc'ed buffers from C to Python without copy using Cython?
Question: In Cython, say I have a C function that returns a large buffer allocated with
malloc() and expected to be freed later with free().
Now I need to pass this buffer to Python as a (bytes) str object, which would
acquire ownership of it, an... |
Subprocess Popen not working with pythonw.exe
Question: I want to be able to get the contents of stdout and stderr when I run the
following script on windows using pythonw.exe:
import subprocess
import sys
import os
import string
import time
tmpdir = 'c:/temp'
cmd = 'dir c:'
... |
Reading a list of lists from a file as list of lists in python
Question: I collected data in the form of list of lists and wrote the data into a text
file. The data in the text file looks like
[[123231,2345,888754],[223467,85645]]
I want to read it back and store in a list of lists in my program. B... |
How to set a charset in email using smtplib in Python 2.7?
Question: I'm writing a simple smtp-sender with authentification. Here's my code
SMTPserver, sender, destination = 'smtp.googlemail.com', '[email protected]', ['[email protected]']
USERNAME, PASSWORD = "user", "password"
# ... |
Matplotlib: linewidth is added to the length of a line
Question: When I draw a line segment in matplotlib the linewidth seems to be added to
the length of the line. Below my code (not the most pythonic code, but it
should do the trick). Am I doing something wrong or is this just a feature of
matplotlib?
... |
How to upload image files to ipython notebook for further image processing
Question: Instead of working with generated plots and graphs I want to use existing
pictures to perform image processing on them. In
[`sage`](http://www.sagemath.org/) one writes:
from pylab import imread
image = imread(DATA+"... |
Using IPython interchangeably with code module if IPython exists
Question: In an existing code snippet, I have
import sys
from code import InteractiveConsole
class FileCacher:
"Cache the stdout text so we can analyze it before returning it"
def __init__(self):
... |
Difference in FFT between IDL and Python
Question: I'm passing some simple IDL code to Python. However the returned FFT values
form the SciPy/NumPy packages is different than the IDL one and I can't find
out why.
Reducing it all to a simple example of 8 elements I found that the SciPy/NumPy
routines return values that... |
TypeError: coercing to Unicode: need string or buffer, type found
Question: I'm trying to write a code that will read a file and make some manipulations
on it.
the code:
def assem(file):
import myParser
from myParser import Parser
import code
import symboleTable
f... |
Python issue with multiple loops and thread
Question: I'm not a python programmer, but I got a snip of code that was working
perfectly, but I need to modify it to loop trough files and get some data and
do the same task. Apparently it work fine, but on the end of the first line
obtained it crashes like this:
... |
Match an element of every line
Question: I have a list of rules for a given input file for my function. If any of them
are violated in the file given, I want my program to return an error message
and quit.
* Every gene in the file should be on the same chromosome
Thus for a lines such as:
NM_001003443 chr11 + 5997... |
Python beautifulsoup iterate over table
Question: I am trying to scrape table data into a CSV file. Unfortunately, I've hit a
road block and the following code simply repeats the TD from the first TR for
all subsequent TRs.
import urllib.request
from bs4 import BeautifulSoup
f = open('out.tx... |
Capturing images from a camera in Python: easy, reliable, cross-platform
Question: What is the most suitable way to capture a still image from Python and convert
to a PIL image?
Google gives me numerous ways with OpenCV and lesser-known libraries. I want
an easy, reliable, mature, cross-platform library for this purpo... |
Python Fast Input Output Using Buffer Competitive Programming
Question: I have seen people using buffer in different languages for fast input/output
in Online Judges. For example this <http://www.spoj.pl/problems/INTEST/> is
done with C like this:
#include <stdio.h>
#define size 50000
int ma... |
Django 1.4 Development Environment with zc.buildout
Question: I am trying to create a dev environment for the Django 1.4 project using the
following guide:
<http://www.stereoplex.com/blog/a-django-development-environment-with-zc-
buildout>
**virtualenv** part of the guide runs ok with the following output:
... |
Is there a universal way of iterating over a set or values of a dict in Python 2.7?
Question: I expect the collection to be either a set or a dict. Problem is that:
for element in collection:
print element
will give me the elements if collection is a set, but indexes if collection is
a dict... |
Recording and asserting an empty mock list in python unittest
Question: I'm using `unittest` and `mock` (Michael Foord's module) to test some python
code.
I have something like this (this is a proof of concept that could be rewritten
more cleanly, but my real code needs to behave like that `foo` function):
... |
Using pymongo tailable cursors dies on empty collections
Question: Hoping someone can help me understand if I'm seeing an issue or if I just
don't understand mongodb tailable cursor behavior. I'm running mongodb 2.0.4
and pymongo 2.1.1.
Here is an script that demonstrates the problem.
#!/usr/bin/python
... |
How to create managers for the worker threads?
Question: The code works fine for a single "manager", which basically launches some HTTP
GETs to a server. But I've hit a brick wall.
How do I create 2 managers now, each with its own Download_Dashlet_Job object
and tcp_pool_object? In essence, the managers would be comma... |
Creating instance names from a list (Python)
Question: I've got a function that builds a random number of object instances. For the
sake of demonstrating the general idea, we're going to pretend that this is an
algorithm to build a series of nethack-like rooms.
The requirements are such that I won't know how many inst... |
Get return value of ruby function in python
Question: I have a ruby script that gets executed by a python script. From within the
python script I want to access to return value of the ruby function.
Imagine, I would have this **ruby script** _test.rb_ :
class TestClass
def self.test_function(som... |
Finding the location of a given arc distance along a parameterized curve in python
Question: I have a parameterized 2D curve: (x,y) = f(t)
The function f is arbitrary but differentiable and hence I can figure out the
differential arc length ds along the curve at any point using standard
formulas. I can also get the to... |
Python 3.x: Using string.maketrans() in order to create a unicode-character transformation
Question: I would like to write the following code:
import string
frm = b'acdefhnoprstuw'
to = 'אקדיפהנופרסתאו'
trans_table = string.maketrans(frm, to)
hebrew_phrase = 'fear cuts deeper than swords... |
python virtualenv: why can I still import old modules in clean/new virtualenv
Question: I'm starting a new Python project, and I want to work with **virtualenv** to
have a clean start. After setting one up though, I can still import old
modules that I have not installed for the new virtualenv - why?
I created one with... |
os.walk raises "unknown exception" in Eclipse/PyDev when path is a windows mapped network drive
Question: I am trying to write a module that searches for different files on mapped
drives in a Windows environment. This works perfectly in PythonWin and Idle
but raises an exception _"Unknown exception when splitting input... |
Python packages and imports - clarification needed
Question: The import function of Python still confuses me sometimes. Here's an example:
My project has the following package structure:
Project/
src/
example/
__init__.py
an_example.py
top/... |
python lxml unavailable in dev_appserver(gae,windows)
Question: I have installed lxml yet.
It works fine in IDLE.
But when I start an basic app described below with dev_appserver.py ,server
returns error "No module named lxml".
import webapp2,lxml
class MainPage(webapp2.RequestHandler):
... |
Removing an application kills my Django admin interface
Question: I had a `login` app which I was using. It had a table in my sqlite3 database.
I decided I didn't need it anymore and I removed `'login',` from my
INSTALLED_APPS and I deleted the app directory. However, now whenever I go to
`/admin` I get:
... |
Limiting scope of Python import
Question: I have some code that looks like this:
from pyparsing import Word, alphas, Optional, ...
# Do stuff ...
# And at the end, save a result to the outside world.
parser = ...
# Now use parser but don't use anything else from pyparsing again.
... |
declarations within python class equivalent to _init_?
Question: I was wondering if the declarations put at the top of the python class are
equivalent to statements in `__init__`? For example
import sys
class bla():
print 'not init'
def __init__(self):
print 'init'
... |
Error when running simple python script
Question: When I run the following:
import sys
if __name__ == '__main__':
print 'before exit'
sys.exit(0)
The output is:
before exit
Exception in thread Thread-1 (most likely raised during interpreter shutdown):
... |
Python: parse commandline
Question: I'm writing a CLI application in python with is used by means of a rather
elaborate commandline language. The idea is very similar to find(1) which
arguably has the same property.
Currently, the parser is completely handwritten using a handmade EBNF
description language. The problem... |
wxPython caret move event
Question: What event is called when the caret inside a TextCtrl / Styled TextCtrl has
its position changed? I need to bind the event to show in the status bar, the
current position of the caret.
Answer: Try binding the `wx.EVT_KEY_UP` event with the `wx.TextCtrl` object like this:
... |
python multiprocessing pool Assertion Error in interpreter
Question: I am writing a sample program to test the usage of multiprocessing pool of
workers in python 2.7.2+
This is the code i have written in the python ubuntu interpreter
>>> from multiprocessing import Pool
>>> def name_append(first_nam... |
How to markup a transparent pygtk pycairo window and save the combined image?
Question: I am trying to develop a transparent window on which I can markup ANYTHING
that is on my screen (including dynamic). My final goal is to overlay graphs
in online scientific publications, click and accumulate points along curves
and ... |
Python permutation
Question: How would I accomplish the following in python:
first = ['John', 'David', 'Sarah']
last = ['Smith', 'Jones']
combined = ['John Smith', 'John Jones', 'David Smith', 'David Jones', 'Sarah Smith', 'Sarah Jones']
Is there a method to combine all permutations?
... |
How do I find the Subsets of given Set in Sage?
Question: I have code that looks like this:
def Z(m,n):
return CartesianProduct(IntegerRange(m),IntegerRange(n))
for v in Subsets(Z(2,2)):
print v
However, when I try to run it, I get the following error:
Traceb... |
get image from website
Question: I try to improve a [recipe](http://manual.calibre-ebook.com/news.html) for
[calibre](http://calibre-ebook.com/) and replace the default cover image with
the cover image of the current newspaper issue.
The way to go has something to do with `get_cover_url`
([link](http://manual.calibre-... |
Getting variables from Scapy using Python
Question: Hi I need help trying to access elements in what seems to be a tuple that
scapy is returning. The code is below.
ans,unans=sr(IP(dst="www.google.com",ttl=5)/ICMP(),verbose=0)
ans.summary(lambda (s,r): r.sprintf("%IP.src%") )
If I enter Scapy a... |
exiting a running command in python
Question: I'm new to python. I'm writing a script that calls a command line tool and
displays the output from the command on the screen. The issue is that after
the command runs it doesn't exit on it's own, it requires manual typing of
ctrl-c to stop and continue on with the rest of ... |
When attempting to upload a UTF-8 text file to Google Drive with the Google API client for python, I get a UnicodeDecodeError
Question: **This question is still unsolved! Please answer if you know**
**Bug**
I have filed a bug here
[http://code.google.com/p/google-api-python-
client/issues/detail?id=131&thanks=131&ts... |
Connect to Database via proxy a python script
Question: I have a python script that connects to a remote MySQL database using the
python library MySQLdb. It works fine but how can I get it to connect through
a proxy that I'm behind when at work. I can connect via the command line in
ssh, but how do I get the python scr... |
Slow image processing with Python and PIL
Question: I'm trying to sort the pixels of images in order of RGB values. Being new to
Python i tried this:
from PIL import Image
source = Image.open("source.jpg")
colors = source.getcolors(source.size[0] * source.size[1]) #maxcolor value =256, get ... |
Can't get Flask running using Passenger WSGI on Dreamhost shared hosting
Question: I'm trying to get a Flask "hello world" application working on a Dreamhost
shared server, following the [instructions on their
wiki](http://wiki.dreamhost.com/Flask), but I'm not having any luck.
My Flask application is the "hello world... |
wxPython 2.9 on Mac Os X
Question: I am using Enthought Python Distribution (7.2, 64-bit). It comes without
wxPython (which is quite important). However, wxPython-2.9 seems to support
64-bit Cocoa interface, so I gave it a try. Actually, it all went good: the
command
python build-wxpython.py --osx_cocoa ... |
Is there a way to set the Pygame icon in the taskbar? set_icon() only seem to affect the small icon in the actual window
Question: While running my program the icon I configured with
`pygame.display.set_icon(icon)` displays only in the window. In the taskbar
the default python icon remains the same.
Is there a way to ... |
Solving Puzzle in Python
Question: I got one puzzle and I want to solve it using Python.
> Puzzle:
>
> A merchant has a 40 kg weight which he used in his shop. Once, it fell from
> his hands and was broken into 4 pieces. But surprisingly, now he can weigh
> any weight between 1 kg to 40 kg with the combination of thes... |
Python script to fetch URL protected by DES/kerberos
Question: I have a Python script that does an automatic download from a URL once a day.
Recently the authentication protecting the URL was changed. To get it to work
with Internet Explorer I had to enable DES for Kerberos by adding
SupportedEncryptionTypes " 0x7FFFF... |
python, Json and string indices must be integers, not str
Question: I am using Python, and I sent a request to a URL and received a reply using
httplib2. The reply I got was in JSon, how do I access a specific parameter.
What I have at the moment is:
resp, content = parser.request(access_token_uri, metho... |
very slow cython classes?
Question: This code which contains cython classes:
cdef class Bench:
cdef long n
def __cinit__(self, long n):
self.n = n
cpdef int factors(self):
n = self.n
cdef int fac = 0
cdef unsigned long i
... |
Python: getting lowest integer in list of tuples
Question: My current plan is to determine which is the first entry in a number of
[Tkinter](http://wiki.python.org/moin/TkInter) listboxes highlighted using
`.curselection()` and combining all of the resulting tuples into a list,
producing this:
tupleList ... |
Using Beautiful Soup to convert CSS attributes to individual HTML attributes?
Question: I'm trying to write a program that will take an HTML file and make it more
email friendly. Right now all the conversion is done manually because none of
the online converters do exactly what we need.
This sounded like a great oppor... |
Create and stream a large archive without storing it in memory or on disk
Question: I want to allow users to download an archive of multiple large files at once.
However, the files and the archive may be too large to store in memory or on
disk on my server (they are streamed in from other servers on the fly). I'd
like ... |
how to add image with text in qlistwidget pyqt4 python?
Question: How to add image/icon with text in a qlistwidget in pyqt4 python? I want to
add an icon with text just like a chat system. thanks
Answer: I have tried this right now and it works, supposing you have a file named
tick.png in the same folder as this scri... |
Python: Unresolved import error for sqlite3 in PyDev in Eclipse
Question: import sqlite3 generates:
Unused import: sqlite3
Unresolved import: sqlite3
sqlite3 Found at: DatabaseTests
import sqlite3
However, this works perfectly in the terminal when using the python command-
line.
I... |
importing simple program using pyqt4 and python
Question:
from PyQt4.QtGui import QApplication, QMainWindow, QPushButton, \
QLabel, QVBoxLayout, QWidget
from PyQt4 import QtGui
import sys
import subprocess
class MainWindow1(QMainWindow):
def __init__(self, parent=None)... |
Python: CheckBox-es in QTableWidget's column
Question: I've just started to work with python, so I run into problem. I've searched
everywhere, but I couldn't find similar example. So, the problem is following:
I made a simple GUI using QT-Designer. QTableWidget is being filled out by
clicking on button Analyse. (as you... |
Python: can a class instance evaluate to any type?
Question: A class can act as a string through its __str__ method, or as a function via
its __call__ method. Can it act as, say, a list, or a tuple?
class A (object):
def __???__ (self):
return (1, 2, 3)
>>> a = A()
>>> a ... |
Python multiplication table syntax differences
Question: So I'm learning python as a beginner and have been using How to Think Like a
Computer Scientist for python 3. I'm on the chapter about iteration, doing the
coding from my own brain instead of copy/pasting so I remember it easier.
When doing the last part of the ... |
Split string by multiple separators?
Question: > **Possible Duplicate:**
> [Python: Split string with multiple
> delimiters](http://stackoverflow.com/questions/4998629/python-split-string-
> with-multiple-delimiters)
Can I do something similar in Python?
Split method in VB.net:
Dim line As String = ... |
python mechanize FormNotFoundError
Question: I am working on mechanize to fetch form element
import mechanize
br = mechanize.Browser()
br.set_handle_robots(False)
br.open("http://www.bnm.gov.my/index.php?ch=12&pg=622")
br.select_form(name="Rates")
But this is throwing error:
... |
How to optimize a wxpython GUI (without threading preferably)? hints for code below?
Question: My GUI with following code does not have threads.The image display hogs up
lots of memory and GUI is blocked ,and I can only call one function at a
time.Please suggest simple hacks to make the GUI faster.Anyways The Image
pro... |
avoid user abort python subprocesses
Question: I want the process i initiate through the script to run on webserver even if
user closes the page. It doesn't seem to be working with this:
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import cgi,cgitb,subprocess
print "Content-Type: t... |
lightweight unit testing in python
Question: I'm considering using Python to teach introductory programming, and I'm
looking for a lightweight unit testing framework. I've taken a look at
unittest, and--as far as I can tell--it looks insanely _non_ -lightweight.
For example, here's what I'd like to be able to write:
... |
Python dict using dot notation and chaining
Question: Ideally what I am aiming to accomplish is a class that extends (or is very
similar to) a `dict` in Python with the additional capabilities:
* Dot-Notation capable for setting and getting values
* Key-Value capabilities like `dict` (i.e. setitem,getitem)
* Can... |
Media Play/Pause Simulation
Question: My keyboard contains a row of buttons for various non-standard keyboard tasks.
These keys contain such functions as modifying the volume, playing or pausing,
and skipping tracks. How can I simulate a basic play/pause with Python? I am
on Windows, by the way.
Answer: I would use
[... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.