text
stringlengths
226
34.5k
jQuery Image Upload - CodeIgniter Question: I use jQuery Image upload like this <http://blueimp.github.com/jQuery-File- Upload/> I get the thumbnail and after clicking the upload button I get the progress bar, but then get 'SyntaxError: JSON.parse: unexpected character' view page </body> </html> ...
AttributeError: 'list' object has no attribut 'has_key' in App Engine Question: I am having some issues with the app engine's bulkloader. Below I have inserted both the bulkloader.yaml, hs_transformers.py, and error log. Any idea as to what is generating this error? My `hs_transformer` function works if I return a sing...
Using a grammar parser for Python and constructing files from the tree Question: I have a custom made grammar for an interpreted language and I am looking for advice on a parser which will create a tree which I can query. From the structure I would like to be able to generate code in the interpreted language. Most gram...
Task Manager Module Question: I was wondering if there is a module that allows the program to see what tasks are running. For example, if I am running Google Chrome, Python Idle, and the program, it should see all 3. (It is most important that it can see its self.) Answer: [**psutil**](http://code.google.com/p/psutil...
Emacs Python-inferior shell not showing prompt after matplotlib show() command Question: So I've been experimenting with numpy and matplotlib and have stumbled across some bug when running python from the emacs inferior shell. When I send the py file to the shell interpreter I can run commands after the code executed....
Python - What is the fastest way i can copy files from a source folder to multiple destinations Question: source = /tmp/src contains a,b,c,d files destinations = '/one' , '/two' so i want to copy files a,b,c,d to both destinations '/one' and 'two' something like source = '/tmp/src' destinations = [...
join with a separator added at the end when not empty Question: I need to append all elements in `list_` to a `string`; at the end I need to add a suffix. A dot '.' has to separate all elements: list_ = args[f(n) : f(n+1)] if list_: string += '.' + '.'.join(list_) + '.' + suffix # works except ...
Constantly looking for user input in Python Question: How would I write a Python program that would always be looking for user input. I think I would want to have a variable equal to the input and then something different would happen based on what that variable equaled. So if the variable were "w" then it would execut...
PyQt - how to replace QString with sip API 2 Question: Please show me how to replace this code: import sip sip.setapi("QString", 2) ... text = QString.fromLatin1("<p>Character: <span style=\"font-size: 16pt; font-family: %1\">").arg(self.displayFont.family()) + \ QChar(ke...
How to cast object in Python Question: I have two classes (let's call them Working and ReturnStatement) which I can't modify, but I want to extend both of them with logging. The trick is that the Working's method returns a ReturnStatement object, so the new MutantWorking object also returns ReturnStatement unless I can...
python won't create thread? Question: I might be missing something silly, but ive ran my code in pythonwin and it works, but when I run it in command-line it freaks import time, thread def print_t(name, delay): while 1: time.sleep(delay) print name try: thr...
How to make Botan RSA signature verification match that of PyCrypto Question: I'm developing a key generator that generates RSA signatures that are to be downloaded to the clients computer. In the clients computer i would like to use a RSA signature and a public key to validate the string. What i would like to know, i...
clean C++ extension build directory in setup.py Question: I have a python package which contains a C++ extension. The C++ extension is built within `setup.py` using its own Makefile, and the .so files are create in its own subfolder, and then copied in the build folder. When I call `python setup.py clean`, only the b...
Find N largest lines from a file: how would you make this better? Question: I was recently rejected from a potential employer after submitting this code. They suggested I wasn't technically capable enough. I'm wondering if someone could shed light on to how to make this better/more efficient. The question was to find ...
how is a dictionary sorted? Question: Ladies and Gents, I have a question about dictionaries in python. While playing around I noticed something that _to me_ seems strange. I define a dict like this stuff={'age':26,'name':'Freddie Mercury', 'ciy':'Vladivostok'} I then add the word 'first' to stuff like this: > stu...
ImportError: No module named bottle Question: $ sudo pip install bottle Downloading/unpacking bottle Downloading bottle-0.10.7.tar.gz (55Kb): 55Kb downloaded Running setup.py egg_info for package bottle Installing collected packages: bottle Found existing installation: bottle 0.10.7 ...
Clear Clipboard? Question: Is it possible for python to clear the clipboard? If so ... how can I do it? I need this so in my quiz program, students can't copy paste answers from the internet and other files. **EDIT:** Im using WinXP and Python 2.6 Answer: from ctypes import windll if windll.user32.OpenClip...
Neo4j slow? I must be doing something wrong, please tell me what it is Question: I'm seeing some rather improbable performance results from the embedded Neo4j, on the surface it's orders of magnitude slower than expected so I'm assuming I'm "doing it wrong", although I'm not doing anything complicated. I'm using the l...
Asynchronously retrieving information from a process Question: Here is the pseudo code for what I want to do. import time def run(): while x < 10000000: x += 1 if __name__ == "__main__": p = Process(run) p.start() time.sleep(3) ...
python loading c lib with CDLL, doesn't see libraries in the python path Question: I'm trying to get some open source academic code working (the project home is [here](http://lammps.sandia.gov/)). It is a big C++ codebase with a (very) thin python wrapper which uses `CDLL` to load the C++ and call some C functions that...
Python module not working (not able to import) even after including it in PATH variable Question: I have one testing module that I want to use for android testing. I have the files but there is no installation file for it, so I added the module to PATH variable, even then it doesn't work I try to import it. Any way to...
list manipulation in python Question: I have a list with sublists in it. EG: (`[1, 2], [1, 56], [2, 787], [2, 98], [3, 90]`) which is created by appending values to it while running a for loop. I am working in python, and i want to add the 2nd element of each sublist where the 1st elements are same. in my eg: i want t...
Enqueue and play a folder of .mp3s in Windows Media Player with Python Question: Is it possible to play all the .mp3's within a folder in windows media player? I am using Python 3.2, and so far I have code that returns the absolute location of a random album in my music folder. I would like to take that string and som...
Open COM application in NET using IronPython Question: I have been trying to perform what initially seemed a trivial task: opening up a WordPerfect program using python and .NET. After 2 weeks of near-success and miserable failure, I am starting to wonder if all .NET paths are designed to lead the programmer toward the...
Adding the digits of an int and Python Question: import sys def keepsumming(number): numberlist = [] for digit in str(number): numberlist.append(int(digit)) total = reduce(add, numberlist) if total > 9: keepsumming(total) if total <= 9: ...
get unix time from yesterday 0000 hrs to today 0000 hours using python Question: I need to get the following values Today = 6th Feb time 1 = 5th Feb 0000 hrs time 2 = 6th Feb 0000 hrs. So I have 24 hours in epoch time. The reference is today but not now() So far I have this. ...
Configuring the SubLime Linter Plugin to use Ruby 1.9 Syntax Question: I'd like to get the SubLime Linter plugin (<https://github.com/Kronuz/SublimeLinter>) to recognize Ruby 1.9 syntax. Has anybody been able to get this to work in SublimeText 2? Here is my current default settings file: /* Subl...
Flipping a picture across the vertical axis in python Question: I am trying to flip a picture across its vertical axis in python but have no idea how to start. any suggestion would be appreciated. Thanks. Answer: For something as simple as this, PIL is not really needed - you can do it with numpy `fliplr`. ...
Efficiently processing all data in a Cassandra Column Family with a MapReduce job Question: I want to process all of the data in a column family in a MapReduce job. Ordering is not important. An approach is to iterate over all the row keys of the column family to use as the input. This could be potentially a bottlenec...
Django, Virtualenv, nginx + uwsgi import module wsgi error Question: Im trying to setup my django project on a staging server with nginx, virtualenv, and uwsgi, but I keep getting an import module wsgi error. If theres a community I can find an answer is here... Thank you all in advance. This are my configuration fil...
Python matplotlib : plot3D with a color for 4D Question: I am trying to make a 3D plot from x, y, z points list, and I want to plot color depending on the values of a fourth variable rho. Currently I have ; fig = plt.figure() ax = fig.add_subplot(111, projection='3d') ax.plot3D(cell_x, cell_y, c...
Convert RGBA PNG to RGB with PIL Question: I'm using PIL to convert a transparent PNG image uploaded with Django to a JPG file. The output looks broken. ### Source file ![transparent source file](http://i.stack.imgur.com/I2uNe.png) ### Code Image.open(object.logo.path).save('/tmp/output.jpg', 'JPEG') ...
What is the most Pythonic way to modify the function of a function? Question: I have a function I am using to read in files of a particular format. My function looks likes this: import csv from collections import namedtuple def read_file(f, name, header=True): with open(f, mode="r") ...
Python subprocess issue on Windows Question: I'm trying to write a Python script to convert a bunch of images. It's something like the following code (after a huge minimization): #!/usr/bin/python # -*- coding: utf-8 -*- from subprocess import call cmd = ' '.join(['convert.exe', '-resiz...
M-x breakpoints in python-mode in Emacs Question: I have read in a several places (e.g. [here](http://stackoverflow.com/questions/283294/django-debugging-with-emacs)) that I can use `M-x space` to add/remove breakpoints in my python files when debugging with Emacs. However, when I type `M-x space` once I have opened `...
Python OpenCV cv.WaitKey spits back weird output on Ubuntu modulo 256 maps correctly Question: I am running Ubuntu 11.10 (Lenovo T400) with OpenCV 2.2 (I believe as imports are done as import cv2.cv as cv). This problem also happens if i just 'import cv' instead. I recently started having this problem, and it's kind o...
Python, networkx Question: I need help since I'm not expert in programming. How can I draw a planar graph (A graph is said to be planar if it can be drawn in the plane such that there are no edge-crossings) for a given graph with n nodes and E edges. and then flip the edges to have another planar graph.( for loop unti...
Updating XML Elements and Attribute values using Python etree Question: I'm very new to Python scripting, I'm trying to use 2.7 ElementTree to parse an XML file then update/replace specific element attributes with values sourced from a test data file. The idea is to be able to use a base XML file to then load and popul...
Python UTF-16 CSV reader Question: I have a UTF-16 CSV file which I have to read. Python csv module does not seem to support UTF-16. I am using python 2.7.2. CSV files I need to parse are huge size running into several GBs of data. Answers for John Machin questions below print repr(open('test.csv', 'rb...
python program for accessing values from csv files and storing it into a database using wamp Question: I am new to Python and [WampServer](http://www.wampserver.com/en/). I want to retrieve values from csv files (more than 10 GB) and, after some processing, store them in a MySQL database using Wamp efficiently. I have...
Error in simple python module Question: I tried to write a little python script today but have failed horribly. Why is it that the code below gives me the following error after being called from the shell? Error File "./testmod.py", line 15, in <module> printdnsfile(sys.argv[1]) File "./te...
How to multiplex multiple blocking Python generators into one? Question: Consider the following pseudo code: def g_user(): while True: yield read_user_input() def g_socket(): while True: yield read_socket_input() def g_combined(gu, gs): # ...
KeyError being thrown after logging in to Django admin Question: I'm getting a pretty nasty KeyError after logging into the Django admin. It is unable to find the key "user". If it helps, I have a model named "User". How do I fix this? Could something be wrong with my configuration? I am using the default admin config...
Django on apache2/mod_wsgi and collectstatic Question: I'm configuring Django on Apache under Ubuntu 11.04. My media files is not available. httpd.conf Alias /robots.txt /home/i159/workspace/prod-shivablog/shivablog/robots.txt Alias /favicon.ico /home/i159/workspace/prod-shivablog/shivalog/favicon.i...
Split a string "aabbcc" -> ["aa", "bb", "cc"] without re.split Question: I would like to split a string according to the title in a single call. I'm looking for a simple syntax using list comprehension, but i don't got it yet: s = "123456" And the result would be: ["12", "34", "56"] ...
How to convert a python string(include '\b') to a raw string? Question: I use Maya to render my cartoon, and got a problem when I programming with python. Maya gives me an string variable which is a path, and I want to convert it to a normalized path. However, when it comes to '\b', I totally failed to play with it. He...
Python random answering program Question: I wrote this programm #!/usr/bin/env python """ """ import random def CollectStrings(): string_list = [] while True: string = raw_input("What is your question: (enter to quit): ") if not string: retur...
Running fselect using Python Question: I am trying to run this python script called fselect in windows 7. It can be downloaded from this website: <http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/> under this name called Feature selection tool. I am running it on Python 2.7.2.Facing a bit of problem running it.. Typed th...
How to correctly structure SQLAlchemy (declarative style) python project and it`s unittests Question: I am developing large backend for some web apps. This is my first python and SQLAlchemy project, so I am confused with some things. And was kind of spoiled by Java programming tools and IDE`s, compared to python`s (I u...
Python WindowsError: [Error 3] The system cannot find the file specified when trying to rename Question: I can't figure out what's wrong. I've used rename before without any problems, and can't find a solution in other similar questions. import os import random directory = "C:\\whatever" ...
Using BCP to import data to SQL Server while preserving accents, Asian characters, etc Question: I'm trying to import a PostgreSQL dump of data into SQL Server using bcp. I've written a Python script to switches delimiters into '^' and eliminate other bad formatting, but I cannot find the correct switches to preserve u...
How to make a directory structure from list Question: I've been looking into this but im not having much luck. The idea is that python should generate 10 separate 6 digit random codes, these 6 digit codes can then be used as folder names. this seems like such a simple task and i have been using the makedirs to attempt...
Find all CSV files in a directory using Python Question: How can I find all files in directory with the extension .csv in python? Answer: import glob for files in glob.glob("*.csv"): print files
RPython sys methods don't work Question: I have the following code: import sys def entry_point(argv): sys.exit(1) return 0 def target(*args): return entry_point, None However, when I run `python ./pypy/pypy/translator/goal/translate.py t.py` I get the follo...
Importing SciPy does not work Question: I am trying to use SciPy to solve a very simple equation (Kepler's equation) using Newton-Raphson. However, exectuing the program fails with the following error message: return sc.optimize.newton(f, meanAnomaly, f_prime, args=(), AttributeError: 'module' o...
Borda Count using python? Question: I have a list of ballots that look like A>B>C>D>E and some of them that look like A>B>C=D=E. The ballots are in a text file and each ballot is on its own line. I want to assign point values to each candidate. For A>B>C>D>E, A should get 4 points for being in first, B should get 3, C ...
Python 2.6 decorator with parameter Question: I'm writing filesystem cache decorator for django. The problem is when I decorate my function with this decorator and @register.simple_tag I get my_decorated_func takes 0 arguments error (when page is loaded with this template tag) from functools import wraps...
SVG -> Google Drawing Question: I want to create SVG drawings for Google Drawings using Python, generating them in the browser and then uploading them into Google Docs. I see the Google Docs List API (3.0) supports importing files and then uploading them into entries with the ResumableUploader, but I was thinking of cr...
Make a GROUP BY with MapReduce in App Engine Question: I'm looking for a way to make a GROUP BY operation in a query in datastore using MapReduce. AFAIK App Engine doesn't support GROUP BY itself in GQL and a good approach suggested by other developers is use [MapReduce](http://code.google.com/p/appengine-mapreduce/). ...
Stacking astronomy images with Python Question: I thought this was going to be easier but after a while I'm finally giving up on this, at least for a couple of hours... I wanted to reproduce this a trailing stars image from a timelapse set of pictures. Inspired by this: ![Inspiration](http://i.stack.imgur.com/tZ7zW.jp...
Python w/ Pygame - The diffrence between these two sets? Question: I'm using Python 2.7 and Pygame 1.9.1 The fact that there are a few things that pygame and IDLE do not like each other is irrelevant as I attempted to run it as a .py file as well. _This works:_ import pygame y = 0 dir = 1 ...
How to sign a file and then verify? Question: I am writing an application in which I sync a file to a server where I want to sign the file then send it back to the client where it can be verified. There seem to be multiple gnupg modules for Python for Ubuntu/Debian: python-gnupginterface - Python interface to GnuPG (...
How to write to a file using non blocking IO? Question: I want to write to a file using a non-blocking method in Python. On some googling, I found that the language supports `fcntl` in order to do so, but the method to implement the same is not very clear to me. This is the code snippet (I don't know where I am going ...
default python not finding same modules that other pythons can. Any suggestions? Question: Not sure how to explain it and can't seem to figure out why this is happening but I tried to install 'MySQLdb' from macports. When I type 'python' and `import MySQLdb`, then it fails but when I launch python from `/opt/local/bin...
SQLAlchemy Execute with raw SQL containing @DECLARE local tables Question: I'm stuck -- I have the following python script with SQL alchemy which I've been using quite successfully for several other purposes. import sqlalchemy from sqlalchemy import MetaData from sqlalchemy.orm import * ...
pulling a dictionary out of the function that created it (python) Question: I am importing a list from an outside document, and inputing that list into a dictionary. This question is applicable to pretty much all values associated to a variable from inside a function. Once the function is complete how do I pull that in...
trouble getting text from xpath entry in python Question: I am on the website [http://www.baseball- reference.com/players/event_hr.cgi?id=bondsba01&t=b](http://www.baseball- reference.com/players/event_hr.cgi?id=bondsba01&t=b) and trying to scrape the data from the tables. When I pull the xpath from one entry, say th...
python fabric logging Question: I came across fabric modules - Its really cool. It works well for me. Now I have an issue ,how to collect output from fabric script? # cat fabfile.py from fabric.api import * from fabric.contrib.console import confirm env.hosts = ['localhost' , '172.16.10....
Using a dash in a xpath does not work in py-dom-xpath Question: I'm curreny using [py-dom-xpath](http://code.google.com/p/py-dom- xpath/downloads/list) with python 2.7.2 under Debian 4.1.1-21. Everything works pretty well, instead of one XML element. Whenever I try to check a XML document for a xpath like `//AAA/BBB...
No data with QProcess.waitForReadyRead(): non consistent behavior Question: I experienced this bug in a more complex application I am developing. I execute a python server program and want to read the first data available. And then close it. I do that to validate some settings from the server. My problem boils down to...
M2Crypto BIO.readlines hangs, python 2.7 Question: We're in the process of converting a C++ openssl based project to python w/ M2Crypto, and we've run into a somewhat unusual issue w/ the BIO routines from M2Crypto. Specifically, any call to BIO.readlines() hangs forever on a file object. Here's a quick sample of what...
Run a python script in windows Question: I have always used a mac to write and run python scripts. However, I have a bunch of files on a PC that I need to run a script on. I have never really used a PC and don't know how to run the script. If I go to the `command` program on the PC and type in `python`, nothing happen...
Logging Process' STDIN and STDOUT Question: I would like to run a process with `subprocess.Popen()` and communicate with it through the python shell, like the `subprocess.Popen` usual behavior. Beside that, I would like to discursively log the STDIN and STDOUT to a logfile. How can I do it? Answer: Assuming discursi...
Cannot properly display unicode string after parsing a file with lxml, works fine with simple file read Question: I'm attempting to use the lxml module to parse HTML files, but am struggling to get it to work with some UTF-8 encoded data. I'm using Python 2.7 on Windows. For example, consider a UTF-8 encoded file witho...
file not accessible: 'templates/test.html' using jinja2 templates in certain directories Question: A simple GAE application threw the following error on self.jinja2.render_template() on only one computer, but not on any others (both macs and pcs): ERROR 2012-02-14 21:54:04,987 webapp2.py:1528] [Errno ...
Python: How to find n-gram patterns in the text? Question: I have a string which could be arbitrary long say s = 'Choose from millions of possibilities on Shaadi.com. Create your profile, search&contact; your special one.RegisterFree\xa0\xa0\xa0unsubscribing reply to this mail\xa0\n and 09times and this ...
Doxygen and add a value of an attribute to the output documentation Question: [ServiceStack](http://servicestack.net) marks rest paths for web services using c# attributes. For example [RestService("/hello1")] [RestService("/hello2")] public class Hello I would like to make Doxygen include...
Return at least X results from split Question: [split](http://docs.python.org/library/stdtypes.html#str.split) has a maxsplit parameter, which is useful when you want _at most_ X results. If there something similar to return _at least_ X results and populate the rest with `None`s. I'd like to be able to write ...
Python: How do I code to make a button do something else if pressed a second time? Question: I have this music program, so when I click a button it starts playing music. When I press it again, I want it to stop the music, but instead it plays the same beat on top of the first one. How do I get around doing this? EDIT:...
read conf file and make contents available to all files in package Question: myMain.py /myPackage file1.py file2.py confFile.cfg myMain.py imports file1 and file2 etc. and it reads the confFile. what would be the best way for the conf options to be visible in the whole package? i....
ImportError: cannot import name reverse_lazy Question: I'm very new to python and trying to run a piece of Django code on my system, but I'm running into this problem. $ python manage.py runserver Running in development mode. Traceback (most recent call last): File "manage.py", line 11, in ...
Read numbers from formatted file in Python Question: I have file with k columns of numbers (same number of elements for each columns). What is the fastest way to read it and save the numbers in each column in a separate numpy.array? Answer: Try using [`genfromtxt`](http://docs.scipy.org/doc/numpy/reference/generated/...
QR Code decoder library for python Question: I am trying to build an application in python that would encode and decode QR codes. I am successful with the encoder, but i don't find libraries(but [zbar](http://pypi.python.org/pypi/zbar)) for decoding in python. I am using Python 2.7 in a Windows 7 system. I am not able...
Django Testing: no data in temporary database file Question: I'm using a sqlite3 database set up as follows in `settings.py`: DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.spatialite', 'NAME': 'path/to/config.sqlite', 'TEST_NAME': 'path/t...
Python runs file from specific folder but can't run from others Question: I have a VB script which I want to run with python27, when I place my VBS in desktop it can be run successfully but when I copy the same file to another folder and want to run from there it doesn't run!! this is running me crazy, I can't understa...
Rails & NLTK deploying to Heroku Question: I may be wrong, but I have a Rails app which uses python script with some NLTK dependencies (it was easier to achieve what I wanted with it)... It works fine locally (python script runs in the background) of course, but not everything is as smooth when I try to deploy it.. I...
Search a list of list of strings for a list of strings in python efficiently Question: I have a list of list of strings and a list of strings. for example: L1=[["cat","dog","apple"],["orange","green","red"]] L2=["cat","red"] if L1[i] contains any item from L2 I need to put the pairs (for creati...
Python Logging module: custom loggers Question: I was trying to create a custom attribute for logging (caller's class name, module name, etc.) and got stuck with a strange exception telling me that the LogRecord instance created in the process did not have the necessary attributes. After a bit of testing I ended up wit...
Python: ImportError with package Question: I develop in eclipse using pydev plugin. When I run project in eclipse everything works fine. But when I try to run it from command line I get an Import error. I have a dir structure like this: TGRParser |----tgr |--graph ...
markdown to html using a specified css Question: First, let me say - I love markdown. Truly love it. It's simple, it's elegant, it's sexy, it's everything I wish for in a markup language. If I could, I'd propose to it :) So far I've been using it in a very nice and simple way, Vim + [python- markdown](http://www.freew...
Unable to append to clipboard Question: Whenever I try the following in my python interpreter. I am able to copy the word hello to the command line, even after I close the interpreter from Tkinter import Tk r = Tk() r.clipboard_append(" hello ") However if I put this in a file called test.p...
Set encoding in Python 3 CGI scripts Question: When writing a **Python 3.1** CGI script, I run into horrible UnicodeDecodeErrors. However, when running the script on the command line, everything works. It seems that `open()` and `print()` use the return value of `locale.getpreferredencoding()` to know what encoding to...
ImportError: cannot import name get_hexdigest Question: im running into this problem as i try to run a piece of django code on my osX10.7 , python2.7 django1.4 system. how do i obtain get_hexdigest? do i download it from somewhere? Kinnovates-MacBook-Pro:platformsite Kinnovate$ sudo python manage.py runs...
Using jcifs in jython in order to access site using NTLM security Question: For a while now I have been trying to find a way for jython to access site using NTLM. I have just basic knowledge of python and next to none in java, so I could use some help (or an example) how to make the request use NTLM in this script part...
Removing blocks of text with python Question: I'm trying to remove large blocks of text from a file using python. Each block of text begins with /translation="SOMETEXT" Ending with the second quote. Can anyone give me some advice on how to accomplish this? Thank you Answer: You can use re.sub like this: ...
Testing Memcached connection Question: I want to run a basic service which shows the status of various other services on the system (i.e. Mongo, Redis, Memcached, etc). For Memcached, I thought that I might do something like this: from django.core.cache import cache host, name = cache._cache._...
selenium python stuck on this line Question: Why does my code: self.driver.find_element_by_xpath("//*[text()[contains(.,'%s')]]" % ('Sorry')) Get stuck and won't pass this line? Even if I do something like: driver.implicitly_wait(30) self.driver.find_element_by_xpath("//*[text()[...
Can't import pty module even though it's installed Question: I have Python 2.7 installed on OpenSUSE. I'm using the `pty` module to spawn some ptys: import pty But Python can't seem to find it. ImportError: No module named pty Running `help('modules')` in the interpreter shows ...
Force feedparser to sanitize on all content types Question: For a project, I want to use [feedparser](http://code.google.com/p/feedparser/). Basicly I got it working. In the documentation [section about sanitization](http://packages.python.org/feedparser/html-sanitization.html) is described, that not all content types...
what's the difference between `groups` and `group` in Python's `re` module Question: Here it is: import re >>>s = 'abc -j k -l m' >>>m = re.search('-\w+ \w+', s) >>>m.groups() () >>> m.group(0) '-j k' Why `groups()` gives me nothing, but `group(0)` yields some? What is the d...