text
stringlengths
226
34.5k
What does ImportError mean in Python? Question: I try to import a module: import cv And I get the following error message: ImportError: DLL load failed: The specified module could not be found. But if I try to import a library that definitely does not exist, for example: ...
Python hashlib.md5 and ejabberd Question: I am using a python script as an external auth option in ejabberd 2.1.6. I wanted to start encrypting the clear text passwords that come across in the auth verification, so that they are not being stored in plain text in the backend database. When I add the following code to m...
Bizzarre issue trying to make Rpy2 2.1.9 work with R 2.12.1, using Python 2.6 under Windows xp - Rpy can't find the R.dll? Question: I've been having a real issue trying to make Rpy2 play nice with my R install. I first tried installing the rpy2 MSI package, and this didn't appear to work. When I ran the recommended te...
Restarting a Twisted-python Reactor after an unsuccessful connection Question: I am writing a server with multiple clients. When a client starts, the server may not yet be working. So a `reactor.connectTCP` may fail (no receiving end). Currently I'm solving this by looping on a `reactor.run`, i.e.: 1. connect to ser...
Execute a python script stored on a web server using beautiful soup Question: I am trying to create a simple form/script combination that will allow someone to replace the contents of a certain div in an html file with the text they input in an html form on a separate page. The script works fine if everything is local...
Python Classes in 2 Files [Learn Python the Hard Way] Question: Hey guys, I'm currently completing Zed Shaw's ["Learn Python the Hard Way"](http://learnpythonthehardway.org/static/LearnPythonTheHardWay.pdf) and I've been struggling with Exercise 43, which instructs the learner to make a game. For simplicity, I am attem...
Determine if Python script is being executed locally or as CGI Question: Let's say I have a basic Python script, `test.py`: #!/usr/bin/python print "Content-type: text/html\n\n" print "<html>Hello world!</html>" How would one determine if the script is being executed locally, e.g.: ...
How to set process priority using pywin32 and WMI? Question: from win32com.client import GetObject for proc in GetObject("WinMgmts:{impersonationLevel=impersonate,(IncreaseBasePriority,Debug)}").InstancesOf("Win32_Process"): if proc.CommandLine == "<my-command-line>": proc.SetPriority(4) # f...
Dynamic imports + relative imports in Python 3 Question: I have a **Python 3** project where I'm dynamically importing modules from disk, using `imp.load_module`. But, I've run into an problem where relative imports fail, when the relative import occurs within a dynamically imported module. From what I've read, I came...
python How to watch for Win32_Processor LoadPercentage change in wmi? Question: How do I watch for a LoadPercentage change event using the Win32_Processor class? import wmi c= wmi.WMI() x = [cpu.LoadPercentage for cpu in c.Win32_Processor()] Where should the watch for() method be applied so...
python object AttributeError: type object 'Track' has no attribute 'title' Question: I apologize if this is a noob question, but I can't seem to figure this one out. I have defined an object that defines a music track (NOTE: originally had the just ATTRIBUTE vs self.ATTRIBUTE. I edited those values in to help remove c...
Python: How to update value of key value pair in nested dictionary? Question: i am trying to make an inversed document index, therefore i need to know from all unique words in a collection in which doc they occur and how often. i have used [this](http://stackoverflow.com/questions/651794/whats-the-best- way-to-initial...
Python HTTP Server gets multiple requests from iPhone Question: I created a very basic Python http server (Python v3.2) that uses BaseHTTPRequestHandler to handle GET requests. It works fine when I use any web browser on a computer. But, when I use a mobile browser on an iPhone, I always see three GET requests. For ex...
How to create a stock quote fetching app in python Question: I'm quite new to programming in **Python**. I want to make an application which will **fetch stock prices** from [google finance](http://www.google.com/finance). One example is CSCO _(Cisco Sytems)_. I would then use that data to **warn the user when the sto...
Find minimum element in a dictionary of dictionaries Question: I need to find what element of `apple` has the minimum `size`. Tnx for all answers. But there is one problem: I use Python 2.4.2 (I can't change it) and function `min` haven't `key` arg. Yes, I need key of `apple` apple = {1:{'size':12,'colo...
How do I get the x coords to show up after mouse click? - Python Question: I'm trying to figure out how to get the x coords to show up when the user clicks a point in the graphics window. Any ideas? Thanks! Here's my code: **Set graphics window** win = GraphWin("Uncle Scrooges Money Bin", 640,480) ...
Python and FIFOs Question: I was trying to understand FIFOs using Python under linux and I found a strange behavior i don't understand. The following is `fifoserver.py` import sys import time def readline(f): s = f.readline() while s == "": time.sleep(0.0001) ...
Is it possible to use variables in PIL (python)? Question: i'm programing in python 3.1 and using a PIL which are updated for it aswel. Now it's so that my program is getting info from a webpage and i want this info to be drawed at a picture which i already got, so i'm using a variable for this & it's also the part i n...
`python -m unittest discover` does not discover tests Question: Python's unittest discover does not find my tests! I have been using nose to discover my unit tests and it is working fine. From the top level of my project, if I run `nosetests` I get: Ran 31 tests in 0.390s Now that python 2.7 [unit...
How do I create a radial cluster like the following code-example in Python? Question: I've found several examples on how to create these exact hierarchies (at least I believe they are) like the following here [stackoverflow.com/questions/2982929/](http://stackoverflow.com/questions/2982929/plotting- results-of-hierarch...
how to import mysqldb Question: I have installed MySqldb through .exe(precompiled). Its is stored in site- packages. But now i don't know how to test, that it is accessable or not. And major problem how to import in my application like import MySqldb. Help me i am very new techie in python i just want to work with my e...
Use app engine yaml parser in scripts Question: I have some configuration files I want to write in yaml and read in a Python script running on Google app engine. Given that app engine uses app.yaml, index.yaml among others it seems reasonable to assume there is a python yaml parser available. 1. How can I gain acces...
.PY into .EXE Python 2.6 Question: I'm trying to convert my .PY script into a .EXE file, in the process I have tried PY2EXE with the following command line.. `python C:\Users\Noob\Desktop\setup.py py2exe -p ftplib` -> -p ftplib is for my module import. When I use this code, I'm left with an .EXE and a bunch of files, i...
Django: Cached items not accessible between processes? Question: I have problems using the django cache. It looks like the cached items are not readable between processes. Is that by design? I haven't found any information on it. Testing on the production server using two ssh sessions in parallel, and setting the cach...
How to create a tree view with checkboxes in Python Question: I've been using Tkinter and Tix to write a small program. I'm at a point where I need a tree view with checkboxes (checkbuttons) so I can select items from the tree view. Is there an easy way to do this? I've been looking at ttk.Treeview () and it looks easy...
RSA encryption in .NET, decryption in python Question: I'm trying to encrypt a short message using RSA algorithm in C# and decrypt the message using a python skript. I'd like to use the .NET classes on the C# side and [pycrypto](http://www.dlitz.net/software/pycrypto/) on python side. I've managed both sides to use th...
urlib2.urlopen through proxy fails after a few calls Question: **Edit:** _after much fiddling, it seems urlgrabber succeeds where urllib2 fails, even when telling it close the connection after each file. Seems like there might be something wrong with the way urllib2 handles proxies, or with the way I use it ! Anyways, ...
Asynchronous call into a Synchronous call in Python Question: In essence I am going to make a call to a remote XMLRPC server and it will process the request asynchronously. import xmlrpclib client = xmlrpclib.ServerProxy('http://localhost:8080') client.add(3,5) def add_res...
Python Convert Lines into a list Question: I use ifconfig command with awk to catch system's ip addresses $ ifconfig | grep -E 'inet.[0-9]' | awk '{ print $2}' 127.0.0.1 192.168.8.2 How to convert o/p into a list using python ? Answer: import sys list_of_lines = [line.strip...
Old python hashing done left to right - why is it bad? Question: I am trying to learn how to defend against security attacks on websites. The link below shows a good tutorial, but I am puzzled by one statement: In <http://google-gruyere.appspot.com/part3#3__client_state_manipulation> , under "Cookie manipulation", Gru...
multipart/x-mixed-replace ActionScript3 and Google Chrome (and others as well) Question: I have a strange problem, I'm working on a Bluetooth camera we want to provide an mjpeg interface to the world. Mjpeg is just an http server replying one jpeg after the other with the connection keept open. My server is right now ...
Why is there a handshake failure when trying to run TLS over TLS with this code? Question: I tried to implement a protocol that can run TLS over TLS using `twisted.protocols.tls`, an interface to OpenSSL using a memory BIO. I implemented this as a protocol wrapper that mostly looks like a regular TCP transport, but wh...
Python subprocess.Popen slow under uWSGI Question: I've set up a development server running Cherokee on Fedora 14, using uWSGI to interface with my WSGI application. When the application is hit with the first request, I spawn a process like so: from subprocess import Popen Popen(['bash']) # bash is...
Login with python - megaupload Question: I'm trying to fix a program which can login to my MU account and retrieve some data.... I don't know what am I doing wrong....That's the code: #!/usr/bin/env python import urllib, urllib2, cookielib username = 'username' password = 'password' ...
Presence autoload in Python 3.x? Question: Similar feature as: function __autoload(UndefinedClass) { include 'library/'.UndefinedClass.'.php'; } ?> Python package = _init.py, BIOS=MBR, C++= STIL or templates, PHP5 = autoload, but python 3.x ? Answer: No, there is no such featu...
Computing MD5 checksums for files in a list Question: I'm working on a bit of a project in Python. I have a list of files that I want to get the md5checksums for. Then it stores the checksums in another list. Then it checks again and checks to see if they're different. I have the function for getting the checksums work...
Some cache problems Question: 1. I'm wondering if I can delete a cached content made in template cache. I want to delete it from my view. I have in my template `{% cache 500 cache_name sites.number %}` Is it possible to delete all "cache_name" cached content within the view, for example when some action is made? 2...
Algorithm to convert unicode to gsm characters Question: I need an algorithm (preferably in Python) to convert an arbitrary string to a string containing only characters from the GSM alphabet. I need this filter to send the string as text in SMS:es. If possible, the algorithm should also replace characters with their c...
Python: Mock a module without importing it or needing it to exist Question: I am using starting to use a python [mock library](http://www.voidspace.org.uk/python/mock/index.html) for my testing. I want to mock a module that is imported within the namespace of the module under test without actually importing it or requi...
python subprocess.popen get into an infinite loop Question: I'm trying to run the folowing command on a sub process and collecting the output. nmap -n -PN -sT -T4 -p 445,139 10.11.1.0/24 --exclude matrix this command return an error which is fine by me. The problem is when i'm doing this from pyt...
wxpython: nested sizers, and little square in top left corner? Question: I'm trying to look into wxPython and sizers, and I put together the following example: import wx class MyTestFrame(wx.Frame): def __init__(self, parent, title): super(MyTestFrame, self).__init__(parent, ...
Python: get datetime for '3 years ago today'? Question: This must be a duplicate (and documented), but I can't find the answer via Google. In Python, how do I get a datetime object for '3 years ago today'? Thanks! UPDATE: FWIW, I don't care hugely about accuracy... i.e. it's Feb 29th today, I don't care whether I'm ...
Extending c functionality of PIL Question: I want to create functionality similar to PIL's `Image.blend`, using a different blending algorithm. To do this would I need to: (1) directly modify the PIL modules and compile my own custom PIL or (2) write a python c module which imports and extends PIL? I have unsuccessful...
MAC Address from IP across network Question: I hope you're all well. I'm wondering if you could help me or point me in the right direction. I'm currently working on a project that centers around network management. Due to severe time constraints where possible I'm using opensource code. The issue I'm having is that pa...
python script execution through crontab Question: what happens to my script in python that does not run through crontab every minute. My script has execute permissions and then calls two other scripts in python. This is the content of my crontab (#crontab -l): */1 * * * * /usr/bin/rsm/samplesMonitor....
How does sleekxmpp components work? Question: This may sound dumb but I followed this tutorial: <https://github.com/fritzy/SleekXMPP/wiki/Creating-a-SleekXMPP-Plugin> and here's the component at the end that uses the XEP-0077 plugin that was created: import sleekxmpp.componentxmpp class Exampl...
How to turn off blinking cursor in command window? Question: I have a Python script that sends output to a DOS command window (I am using Windows 7) using the print() function, but I would like to prevent (or hide) the cursor from blinking at the next available output position. Has anyone any idea how I can do this? I ...
Is there any working example of "pytap" TAP emitter for Python Question: if we look at like in example 3: #TEST SOME STUFF from TAP.Simple import * plan(3) def in_between(value, bottom, top, msg): ret = ok(((bottom = value) and (value = top)), msg) if (not ret): ...
Scanning for thread violations with Tkinter Question: We are just about to finish a very large update to our application which is built with python2.5 and Tkinter and the following error has crept in sadly: alloc: invalid block: 06807CE7: 1 0 0 This application has requested the Runtime to termi...
Correct Regexp for japanese sentence tokenizer- python Question: This is the current text that i've but the regex isn't correct to split the sentences correction. please help to correct my regex, thank you. import nltk import os, sys, re, glob from nltk.tokenize import RegexpTokenizer jp...
How to capture a command prompt window close event in python Question: I want to capture command window close event from Python. In other words, when the user tries to close the command prompt window, script should detect it and display a message like `Do you really want to exit - Yes/No` Any suggestions about how t...
eclipse, pydev, easy_install-ed eggs problem Question: I have a problem with eclipse and easy_install'ed packages into virtualenv. If I have from sqlalchemy.ext.serializer import loads import statement and put mouse cursor on "load" I get message loads Found at: __module_not_in_the_...
Using ctypes with jython Question: I have a trouble with using ctypes lib in my python script. Here is my code (found on the Internet): if __name__ == "__main__": from ctypes import * user32 = windll.user32 kernel32 = windll.kernel32 class RECT(Structure): ...
Django manage.py shell Throws error when meet "def" Question: I am reading django official tutorial ( <http://docs.djangoproject.com/en/dev/intro/tutorial01/> ). When i try run "python manage.py shell", python throw error: File "D:\DjangoProjects\mysite\polls\models.py", line 8 def __unicode__(sel...
Call subprocess.Popen() when the working directory is on a UNC path, not a mapped drive Question: I would like to run an executable that performs some processing on a dataset located on a remote filer. As part of the design, I'd like the location of the filer to be flexible and something that's passed to my python prog...
Can't set the shop language in Satchmo Question: I'm trying to set the default and only shop language of a Satchmo 0.9.2 installationto Dutch. I'm following the instructions on [translating content](http://www.satchmoproject.com/docs/dev/translation.html): From the directory `/home/myusername/webapps/myshop/lib/pytho...
Why are my pygame images not loading? Question: I found a tutorial online (on Youtube) and it showed me the basics of creating a game with pygame. i found images of the kind he said and what he had. he didn't say where to save them to, i think that may be my problem. here, this is an example of what i have in my progra...
IronPython: Cannot import 'Rect'-struct from System.Windows Question: When I try to import the 'Rect'-struct from System.Windows, IronPython- Interpreter claims that it cannot import. Since I am using the IronPython Tools for Visual Studio, i can also see that the IntelliSense-DropDown does not show this struct. Is t...
Python v3 Logging Question: I could use this code below on Python 2. I tried it on Python 3 and I got an error. Anyone could explain why? Code: import logging import logging.handlers LOG_FILENAME = 'poller.log' # Set up a specific logger with our desired output level poll_logge...
Best way to log a Python exception Question: I'm printing my exceptions to a log file currently with: try: # coode in here except Exception, e: logging.error(e) Could I be printing more information about the exception and the code that generated it than just the exception string...
Broadcasting a python function on to numpy arrays Question: Let's say we have a particularly simple function like import scipy as sp def func(x, y): return x + y This function evidently works for several builtin python datatypes of `x` and `y` like string, list, int, float, array, etc. S...
Improving Postgres psycopg2 query performance for Python to the same level of Java's JDBC driver Question: # Overview I'm attempting to improve the performance of our database queries for SQLAlchemy. We're using psycopg2. In our production system, we're chosing to go with Java because it is simply faster by at least 5...
Why bother to limit the types imported from a python package? Question: When using many IDEs that support autocompletion with Python, things like this will show warnings, which I find annoying: from eventlet.green.httplib import BadStatusLine When switching to: from eventlet.green.ht...
Python cpu temp in system tray Linux Question: I'm using tint2 for a panel and want to show the cpu temp as a system tray icon since there aren't any plugins for tint2 that do that and I'd just like to know how to do this anyway whether there was one or not. The script I have so far is: #! /usr/bin/pytho...
non-prime factorings with some repeats Question: Let's say we have numbers factors, for example 1260: >>> factors(1260) [2, 2, 3, 3, 5, 7] Which would be best way to do in Python combinations with every subproduct possible from these numbers, ie all factorings, not only prime factoring, with **...
Python C-API and Numpy: core dump on import_array Question: //testNumpy.c #include<Python.h> #include<numpy/arrayobject.h> #include<stdio.h> int main(){ printf("import_array\n");fflush(stdout); import_array(); printf("import_array done\n");fflush(stdout); } $ gc...
Sorting a Python list by two criteria Question: I have the following list created from a sorted csv list1 = sorted(csv1, key=operator.itemgetter(1)) I would actually like to sort the list by two criteria: first by the value in field 1 and then by the value in field 2. How do I do this? Answer: Re...
Python - slice array until certain condition is met Question: I need to slice an array from a given index until a certain condition is met. >>> a = numpy.zeros((10), dtype='|S1') >>> a[2] = 'A' >>> a[4] = 'X' >>> a[8] = 'B' >>> a array(['', '', 'A', '', 'X', '', '', '', 'B', ''], dtyp...
How do I perform binary search on a text file to search a keyword in python? Question: The text file contains two columns- index number(5 spaces) and characters(30 spaces). It is arranged in lexicographic order. I want to perform binary search to search for the keyword. Answer: Here's an interesting way to do it with...
Find and append each reference to a html link - Python Question: I have a HTML file I got from Wikipedia and would like to find every link on the page such as `/wiki/Absinthe` and replace it with the current directory added to the front such as `/home/fergus/wikiget/wiki/Absinthe` so for: <a href="/wiki/...
How Can I Allow Object Editing in the Django Admin For Specific Objects ONLY? Question: I'm currently writing a site which uses [django- guardian](http://packages.python.org/django-guardian/index.html) to assign object-level permissions which are used throughout the site. **Here is the desired functionality:** I'd li...
How to convert string to datetime in python Question: I have a date string in following format 2011-03-07 how to convert this to datetime in python? Answer: Try the following code, which uses `strptime` from the [datetime module](http://docs.python.org/library/datetime.html): from datetime import datet...
what is the type of the variable Question: I am a very newbie in Python I have the folllowing code : from SOAPpy import WSDL fichier_wsdl = 'http://geocoder.us/dist/eg/clients/GeoCoder.wsdl' wsdl = WSDL.Proxy(fichier_wsdl) callInfo = wsdl.methods['geocode'] ss = wsdl.geocode('1600 Pe...
Mechanize not logging in to site properly Question: After spending the best part of 3 hours getting nowhere, i thought i would ask a question myself. i am using python and `mechanize`'s `Browser`. I am trying to login to my home router. i can get to the login page, fill the password field (eg `br.form['password'] = 'my...
How to take the first N items from a generator or list in Python? Question: With [linq](/questions/tagged/linq "show questions tagged 'linq'") I would var top5 = array.Take(5); How to do this with Python? Answer: # Slicing a list top5 = array[:5] * To slice a list, there's ...
Persistent ssh session to Cisco router Question: I have search on this site and multiple other locations but I have been unable to resolve my problem of connecting and maintaining ssh session after one command. Below is my current code: #!/opt/local/bin/python import os import pexpect...
Boost python linking Question: I'm adding boost.python for my Game. I write wrappers for my classes to use them in scripts. The problem is linking that library to my app. I'm using `cmake` build system. Now I have a simple app with 1 file and makefile for it: PYTHON = /usr/include/python2.7 BOO...
Help re-write this Python into Ruby: AJAX POST, decode Base-64, and save Question: I'm following a phonegap tutorial and I do not know how to write this "def iphone_upload " action in ruby 1.9.2/rails 3. <http://wiki.phonegap.com/w/page/18270855/Image-Upload-using-JQuery-and- Python> function getPicture...
why isn't this python regex statement returning my viewstate information? Question: def ExtractViewState(string): m = re.match("__viewstate[^>]+value=\"\(\?<Value>[^\"]*\)", string, re.IGNORECASE) return m.group(0) I think I'm missing something, but it m keeps returning None. Blagh. UPDATE: ...
Python function to make arbitrary strings valid filenames Question: Is there a built-in function which strips all characters which cannot be in Windows filenames from a string or replaces them somehow? E.g. `function("Some:unicode\symbols")` \--> `"Some-unicode-symbols"` Answer: import re arbitrary_str...
fcntl.flock - how to implement a timeout? Question: I am using python 2.7 I want to create a wrapper function around fcntl.flock() that will timeout after a set interval: wrapper_function(timeout): I've tried calling on another thread and using thread.join(timeout) but it seems that fcntl.flock() ...
Equation solver in Python Question: Given a simple equation such as: x = y + z You can get the third variable if you bind the other two (ie: `y = x - z` and `z = x - y`). A straightforward way to put this in code: def solve(args): if 'x' not in args: return args['...
How to see the real SQL query in Python cursor.execute Question: I use the following code in Python (with pyodbc for a MS-Access base). cursor.execute("select a from tbl where b=? and c=?", (x, y)) It's Ok but, for maintenance purposes, I need to know the complete and exact SQL string send to the d...
Website to image Question: I'm running Python 3.1 and you would call me an advanced novice :) My question is simple: I'm trying to make a simple program which asks the users for a URL (or multiple URLs) and then goes to the website and takes a screenshot (of the whole page, not just what can be seen in the browser wit...
Comparing Strings Question: Does there exist any inbuilt function in python than can return number of mathching characters in two strings,for example: INPUT: TICK TOCK CAT DOG APPLE APPLES OUTPUT: 3 0 5 The words "TICK" and "TOCK" have a score of 3,...
Getting confirmation window with Selenium-rc Question: I'm running a selenium server (v.2.0b2) and writing a python script to run a test suite on my webapp. from selenium import webdriver import selenium selenium = selenium.selenium('127.0.0.1', 3333, '*firefox', 'http://localhost/') sel...
In python, how do I get timing information like os.times() for a specific child process? Question: I can use os.times or resource.getrlimit to get user time of the current process, all the children processes, or both. How do I get timing information for a specific child process? Answer: I don't know if you can do th...
How to spawn Python2.5 process through Apache and return immediately under Windows Question: I have two Python scripts, one launches the other with subprocess invoke.py: import subprocess p = subprocess.Popen(['python', 'long.py']) print "Content-Type: text/plain\n" print "invoked (%d)" % (p...
Is there a way to access parent modules in Python Question: I need to know if there is a way to access parent modules from submodules. If I import submodule: from subprocess import types I have `types` \- is there some Python magic to get access to `subprocess` module from `types`? Something simila...
mocking functions using python mock Question: I am trying to Mock a function (that returns some external content) using the python mock module (http://www.voidspace.org.uk/python/mock/index.html). I'm having some trouble mocking functions that are imported into a module. For example, in util.py I have ...
mod_wsgi cannot load mysql Question: First I will list my environment and status: Environment: * System: Mac OS 10.6 * Python: 2.6 * Apache: 2.2 * mod_wsgi: 3.3 * mysql: 5.x * php: 3.5 * trac:0.12 Status: I can run trac as alone-server without problem. Now I integrate trac to apache, problem come out. ...
Regular Expression and escape sequences Question: I have a file which contains the list of regular expressions to look for in db. one such pattern is `(/|\)cmd\.com$`. But when i use it with re module, it throws up the below error. If i use the re pattern as `(/|\\\\)cmd\.com$`,it works. So, the question is when i re...
Can I write to terminal and a given file with one command in Python? Question: I have seen this question answered in reference to Bash, but can't find one for Python. Apologies if this is repeating something. Is it possible to print to the terminal and an output file with one command? I'm familiar with using `print >>...
How to save new data in tree model view Question: I'm trying to modify the excellent example of pyqt4 called "Editabletreemodel" but I have a problem I can't manage: after I add a new row in the model, how can I save or update the data I've inserted to a text file? Or more in general, how is it possible to save data fr...
Is this the best way to ensure that a python unicode "string" is encoded in utf-8? Question: Given in arbitrary "string" from a library I do not have control over, I want to make sure the "string" is a unicode type and encoded in utf-8. I would like to know if this is the best way to do this: import type...
Python socket.accept nonblocking? Question: Is there a way I can use python's socket.accept() in a non-blocking way that simply runs it and lets me just check if it got any new connections? I _really_ don't want to use threading. Thanks. Answer: You probably want something like `select.select()` (see [documentation](...
Py2exe lxml woes Question: I have a wxpython application that depends on lxml and works well when running it through the python interpreter. However, when creating an exe with py2exe, I got this error ImportError: No module named _elementpath I then used `python setup.py py2exe -p lxml` and I did n...
Generating cyclic permutations / reduced Latin Squares in Python Question: Was just wondering what's the most efficient way of generating all the cyclic permutations of a list in Python. In either direction. For example, given a list `[1, 2, 3, 4]`, I want to generate either: [[1, 2, 3, 4], [4, 1, 2...
System.DateTime format as a web service arg Question: I would like to use a web service which is written on .NET. I should pass a date value to a method `webservicemethod(on_date)`. It's written in a description that format of this date is `System.DateTime`. I'm using Python as a client language. After googling I tried...
Mercurial CGI (hgweb.cgi) fails Question: I have Mercurial 1.8.1, Python 2.6.6 installed on Win 2k8 R2 running on a vm. I have tried installing from msi, source and using tortisehg. Command-line Hg works fine but I get the same error when running the hgweb.cgi: Traceback (most recent call last): Fi...