text stringlengths 226 34.5k |
|---|
HTTPS for Mercurial 1.9.2 on windows server 2008/IIS 7 giving me Errno 10054
Question: We are a small company (its a Microsoft shop) we are currently using
subversion with VisualSVN installed (pretty easy to setup btw) I am currently
evaluating Mercurial because of branching nightmare in svn.
So first i followed <http... |
Python RegEx nested search and replace
Question: I need to to a RegEx search and replace of all commas found inside of quote
blocks.
i.e.
"thing1,blah","thing2,blah","thing3,blah",thing4
needs to become
"thing1\,blah","thing2\,blah","thing3\,blah",thing4
my code:
... |
How to create page-locked memory from a existing numpy array in PyCUDA?
Question: The [PyCUDA help explains how to create an empty or zeroed
array](http://documen.tician.de/pycuda/driver.html#pagelocked-allocation) but
not how to move(?) an existing numpy array into page-locked memory. Do I need
to get a pointer for th... |
import sqlite3 with Python2.7 on Heroku
Question: I'm trying Heroku with Python, I ran the ["hello word" example with
Flask](http://blog.heroku.com/archives/2011/9/28/python_and_django/)
successfully.
I now want to deploy a very basic application, using sqlite3 and Flask, and I
know the application was working. But I ... |
Remove Holidays and Weekends in a very long time-serie, how to model time-series in Python?
Question: Is there some function in Python to handle this. GoogleDocs has a Weekday
-operation so perhaps there is something like that in Python. I am pretty sure
someone must have solved this, similar problems occur in sparse d... |
Python socked bound to secondary IP gets connection reset from server
Question: I'm trying to create a python socket script that binds to a secondary IP and
connects to a server. When I run the script python gives me a "socket.error:
[Errno 111] Connection refused"
The TCPdump shows that the server I try to connect to... |
Print the first two rows of a csv file to a standard output
Question: I would like to print (stdout) the first two lines of a csv file:
#!/usr/bin/env python
import csv
afile = open('<directory>/*.csv', 'r+')
csvReader1 = csv.reader(afile)
for row in csvReader1:
print row[0]
... |
How to use "import oauth2" in Google App Engine?
Question: I want to use Tumblr's API v2, which includes OAuth. so I need to find a OAuth
module.
I am supposed to use it like this:
import oauth2 as oauth
I have found the oauth2 source code here:
<https://github.com/simplegeo/python-oauth2>
1. I... |
Datetime difference to return Days only?
Question:
$ cat .t.py
import re
from datetime import datetime as dtt
oldestDate = dateComp = dtt.strptime('1.1.1001', '%d.%m.%Y')
dateComp = dtt.strptime('11.1.2011', '%d.%m.%Y')
ind = re.sub(" days,.*", "", str((dateComp - oldestDate)))
p... |
python class data descriptor list
Question: I can't seem to figure out how to get a list of a classes data descriptors.
Basically, I want to run some validation against the fields and unset fields.
For instance:
class Field (object):
def __init__ (self, name, required=False):
self.nam... |
Tree plotting in Python
Question: I want to plot trees using Python. Decision trees, Organizational charts, etc.
Any library that helps me with that?
Answer: There's graphviz - <http://www.graphviz.org/>. It uses the "DOT" language to
plot graphs. You can either generate the DOT code yourself, or use pydot -
<https:/... |
Looping Through Nested List - Convert from String to Float
Question: I am new to Python, so apologies if this seems extremely simple:
I have a csv file with 4 columns and a dozen rows. I import the contests as a
list (list of lists), and the contents come in as strings. What I want to do
is loop through the list (whic... |
Local Appengine stopped working
Question: I tried to run one of my AppEnigne projects (python) today but it will no
longer launch, this is the stack trace I'm getting.
*** Running dev_appserver with the following flags:
--admin_console_server= --port=8080 --clear_datastore
Python command: /u... |
Import contacts from yahoo in python
Question: Is there are official way to import contacts from user address book from
yahoo?
For google it's really simple as:
import gdata
contacts_service = gdata.contacts.service.ContactsService()
contacts_service.email = email
contacts_service.password =... |
Running Python in Windows
Question: Am new to python, i installed python 3.2 in my windows and tried the following
code,
import urllib, urllister
usock = urllib.urlopen("http://diveintopython.net/")
parser = urllister.URLLister()
parser.feed(usock.read())
usock.close()
parser.close()
... |
How to pass variable to a python cgi script
Question: What I want to do is have a single python program in cgi-bin that is executed
by each of many pages on the site, and displays a line of HTML on each page
that is different for each file, but keyed to the URL of that file on the
site.
I know how to get the URL using... |
Python sys.argv out of range, don't understand why
Question: I have a script that I've been using for a some time to easily upload files to
my server. It has been working great for a long time, but I can't get it to
work on my new desktop computer.
The code is simple:
import os.path
import sys
i... |
How to document python function parameter types?
Question: I know that the parameters can be any object but for the documentation it is
quite important to specify what you would expect.
First is how to specify a parameter types like these below?
* `str` (or use `String` or `string`?)
* `int`
* `list`
* `dict`... |
python __getattr__ in parent class __init__ recursion error
Question: following an advice here [subclassing beautifulsoup html parser, getting type
error](http://stackoverflow.com/questions/7684794/subclassing-beautifulsoup-
html-parser-getting-type-error/7685314#7685314) I'm trying to use class
composition instead of ... |
Python running out of memory parsing XML using cElementTree.iterparse
Question: A simplified version of my XML parsing function is here:
import xml.etree.cElementTree as ET
def analyze(xml):
it = ET.iterparse(file(xml))
count = 0
for (ev, el) in it:
count... |
tornado AsyncHTTPClient.fetch exception
Question: I am using `tornado.httpclient.AsyncHTTPClient.fetch` to fetch domains from
list. When I put domains to fetch with some big interval(500 for example) all
works good, but when I decrease the inerval to 100, next exception occurs time
to time:
Traceback (mo... |
Unicode in Django unit test
Question: I try to use a utf8 string in a Django unit test and have included
# -*- coding: utf-8 -*-
but django-admin.py still complaints there is no encoding.
> Traceback (most recent call last):
>
> File "/home/basti/work/virtualenv/bin/django-admin.py", line 5, in
> ... |
Python API for C++
Question: I have a code on C++, that creates file and writes data to it. Is it possible
to use Python's functions to use Python's functionality in my C++ code? For
example, I'd like to do this:
# Content of function.py
from PIL import Image
imgObject = Image.open('myfile.jpg') ... |
Python, empty file after csv writer.. again
Question: My python program loops through a bunch of csv-files, read them, and write
specific columns in the file to another csv file. While the program runs, i
can see the files being written in the correct manner, but once the program is
finished, all the files i've just wr... |
Iterate variable for every node | Node Connectivity in Python Graph
Question: I would like to find node connectivity between node 1 and rest of the nodes in
a graph. The input text file format is as follows:
1 2 1
1 35 1
8 37 1
and so on for 167 lines. First column represents source node, s... |
using a python list as input for linux command that uses stdin as input
Question: I am using python scripts to load data to a database bulk loader.
The input to the loader is stdin. I have been unable to get the correct syntax
to call the unix based bulk loader passing the contents of a python list to be
loaded.
I ha... |
Python Tkinter GUI:add text from an entry widget in a pop up window to a listbox in a different window?
Question: I am trying to add an entry from a toplevel window into a listbox in the main
window. So far I have managed to create a button that opens a new window
containing 4 entry widgets(name, address, phone number ... |
Parsing/Extracting Data from API XML feed with Python and Beautiful Soup
Question: Python/xml newb here playing around with Python and BeautifulSoup trying to
learn how to parse XML, specifically messing with the Oodle.com API to list
out car classifieds. I've had success with simple XML and BS, but when working
with t... |
Django, urls.py, include doesn't seem to be working
Question: I'm trying to include an additional urls.py inside my main urls - however it
doesn't seem to be working. I've done a bunch of searching and I can't seem to
figure it out
main urls.py file - the admin works fine
from django.conf.urls.defaults ... |
How to enable Eclipse debugging features in a web application?
Question: I am using Django framework for my Python Web Application using Eclipse IDE
and PyDev Plugin. How can I use the debugging features?
**UPDATES1** particularly using <http://pydev.org/updates> plugin
**UPDATES2** I already did the following:
**.p... |
Using Groupby to Group a Column in an Access Table in Python
Question: I have been playing with the groupby function from the itertools module for a
while now (like days)
for k, g in groupby(data, keyfunc):
I am really having trouble understanding the syntax. I've tried a variety of
different thing... |
jinja2 macros vs jsp2.0 tags
Question: I am a **java** programmer learning **python/jinja**.
My biggest beef with jinja2 macros is the limitation of having a single
caller(). for example, i could do the following in jsp2 tags:
tag def:
<% attribute name="title" fragment="true">
<div class='title'>$... |
Tweepy (twitter) socket.error Errno 104 (Connection reset by peer)
Question: I am trying to acces the Streaming API, filter it by some terms and then print
out the results, using Tweepy. However I am getting the following error:
File "/usr/local/lib/python2.6/dist-packages/tweepy-1.7.1-py2.6.egg/tweepy/... |
Python - ssh with password to foreign computer without using non-built-in modules
Question: Before you down vote this, let me say that I've read ALOT of questions on this
subject on SO and haven't found the answer. This one has the closest thing to
what I need though on the answer by "Neil".
[What is the simplest way ... |
in python, is there a way to find the module that contains a variable or other object from the object itself?
Question: As an example, say I have a variable defined where there may be multiple
from __ import *
from ____ import *
etc.
Is there a way to figure out where one of the variables in t... |
How to set the sharing rights of a folder in Plone?
Question: I want to set sharing rights of many folders by using a Python script in a
Plone site.
Answer: You need to look at the
[`AccessControl/rolemanager.py`](https://github.com/zopefoundation/AccessControl/blob/master/src/AccessControl/rolemanager.py)
module for... |
Converting strings into another data type, Python
Question: I have the string `"(0, 0, 0)"`. I'd like to be able to convert this to a
tuple. The built in `tuple` function doesn't work for my purposes because it
treats each character as an individual item. I want to be able to convert
`"(0, 0, 0)"` to `(0, 0, 0)` progra... |
PyQt4: Interrupted system call while calling commands.getoutput() in timer
Question: The problem appeared to be very simple, but I can not find any solution after
a day of googling and looking at stackoverflow. Originally I am developing a
simple plasmoid which will send a specific request to local web-server every
30 ... |
Pandas + Django + mod_wsgi + virtualenv
Question: Pandas is producing **'module' object has no attribute 'core'** when being
imported under django and mod_wsgi inside a virtual environment. It works fine
running under the django development server inside the virtual environment.
Other modules e.g.: numpy have no probl... |
C++-classes with SWIG
Question: I try to create a python interface (with swig) from C++-code. With the code
below. When I remove the line:
aClass z = aClass(1);
from the .cpp-file i get the following error:
Traceback (most recent call last):
File "./testit.py", line 3, in <modu... |
main color detection in Python
Question: I have about 3000 images and 13 different colors (the background of the
majority of these images is white). If the main color of an image is one of
those 13 different colors, I'd like them to be associated.
I've seen similar questions like [Image color detection using
python](h... |
Adding testcase results to Quality Center Run from a outside Python Script
Question: I want to try to add all the step details - Expected, Actual, Status, etc. to
a QC Run for a testcase of a TestSet from a Python Script living outside the
Quality Center. I have come till here (code given below) and I don't know how
to... |
Time and date on the basis of seconds elapsed since 1970 year
Question: Using python I have to retrieve value of time and date of an event knowing how
many seconds elapsed since `01/01/1970 00:00:00`.
I started with:
from datetime import timedelta
a = timedelta(seconds=1317365200)
print "%d days... |
Seeing exceptions from methods registered to SimpleXMLRPCServer
Question: I'm writing an xmlrpc-based python 2.7 program, using SimpleXMLRPCServer. I
import the class with all our logic and register it with:
server = SimpleXMLRPCServer(("0.0.0.0", 9001))
server.register_instancce(classWithAllTheLogic... |
How can I represent an infinite number in Python?
Question: In python, when you want to give to a set of elements an associated value, and
you use this value for comparisons between them, I would want this value as
infinite. No matter which number you enter in the program, no number will be
greater than this representa... |
Unusual issue with HTML image and 'file://' specified src
Question: I'm loading an image on the page with a 'file:///some_dir/image.jpg' src path.
I can access the image in a regular tab using this path. Also, saving the page
as HTML and using this path for the image works. However, the image does not
load on the live ... |
After installing matplotlib basemap via Macports, example python code for basemap is not running
Question: I'm using Mac OS X 10.6.8. I installed Python 2.6 using the binary installer
in <http://www.python.org/>. I've been using it along with SciPy and
Matplotlib for my scientific computing needs since March 2011 witho... |
Boost / Python unix timestamps don't match
Question: Python 2.6:
import pytz
import time
import datetime
time.mktime(datetime.datetime(1990, 1, 1, tzinfo=pytz.utc).timetuple())
Result:
631148400.0
Boost 1.46:
auto a = boost::posix_time::ptime(boost::g... |
Python check if a process is running or not
Question: I am trying to create a python script which I will later run as a service. Now
I want to run a particular part of the code only when iTunes is running. I
understand from some research that polling the entire command list and then
searching for the application for t... |
working with combinations object in python
Question:
>>> import itertools
>>> n = [1,2,3,4]
>>> combObj = itertools.combinations(n,3)
>>>
>>> combObj
<itertools.combinations object at 0x00000000028C91D8>
>>>
>>> list(combObj)
[(1, 2, 3), (1, 2, 4), (1, 3, 4), (2, 3, 4)]
>>>
... |
How do I fix the syntax in my code to make my radio buttons work with my dictionary?
Question: I am trying to learn how to use a _dictionary_ with a radio button. I have the
code below but when ever I run it I get an error.
The error says:
Traceback (most recent call last): File "/Volumes/CHROME
... |
Difference between bson.objectid.ObjectId and bson.ObjectId?
Question: I have generated an ObjectId through two different methods as follows:
user@ubuntu:~$ python
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for mor... |
How do I ensure that a Python thread dies after its target function completes?
Question: I have a service that spawns threads.
The threads are started by providing a target function.
It would appear that the thread doesn't "die" when the function ends. I know
this because the thread makes some SSH connections with
... |
How to add OAuth 2.0 providers?
Question: I could reproduce my bug using servside OAuth2.0 only so it's not javascript
and the issue is that I must reload to make login / logout take effect and I
want it to work without javascript. I have an idea that making logout twice
makes logout effective so I could use a custom r... |
gstreamer - Wadsworth's constant thumbnailer
Question: I'm trying to build a video thumbnailer using gst-python, it looks like this.
from __future__ import division
import sys
import logging
import pdb
_log = logging.getLogger(__name__)
logging.basicConfig()
_log.setLeve... |
Plone 4: List members that have been given Reviewer role on a specific folder
Question: I've created a new view for a folder (based on Tabular view) the only the
Title and Date for regular viewers, but if the logged in user had the "Editor"
role, it shows an additional column. That column needs to list the users who
ha... |
pyparsing - parse xml comment
Question: I need to parse a file containing xml comments. Specifically it's a c# file
using the MS `///` convention.
From this I'd need to pull out `foobar`, or `/// foobar` would be acceptable,
too. (Note - this still doesn't work if you make the xml all on one line...)
te... |
Python global threading.condition() and use in multiple modules
Question: **EDIT: the problem I was experiencing was not related to the structure of my
program. It was FAPWS3's routing picking a similar, closely named function.**
I have a large program spread across multiple files. I need to use the
threading.conditio... |
How to write a batch file showing path to executable and version of Python handling Python scripts on Windows?
Question: It should display path to executable and version of Python for scripts run
with direct invocation of Python (`python myscript.py`) as well as for scripts
run directly (`myscript.py`). Script should n... |
Python's multiprocessing.Queue + Process: Properly terminating both programs
Question: Given this Python program:
# commented out code are alternatives I tried that don't work.
from multiprocessing import Process, Queue
#from multiprocessing import Process, JoinableQueue as Queue
de... |
Trouble initiating a TCP connection in Python--blocking and timing out
Question: For a class project I'm trying to do some socket programming Python but
running into a very basic issue. I can't create a TCP connection from my
laptop to a lab machine. (Which I'm hoping to use as the "server") Without
even getting into t... |
Setting Mac OSX Application Menu menu bar item to other than "Python" in my python Qt application
Question: I am writing a GUI application using python and Qt. When I launch my
application on Mac, the first menu item in the Mac menu bar at the top of the
screen is "Python". I would prefer the application name there to ... |
Array of colors in python
Question: What's the quickest way to get an array of colors in python? Something I can
index and pass to as the "color=" argument plotting in pylab.
The best I can come up with is:
colors = [(random(),random(),random()) for i in range(10)]
but a solution that can generate... |
Nested loops for comparing 2 files
Question: I am writing a program to compare two files. For each line in file 1, I want
to compare it to all lines in file 2, then continue with the next line in file
1. The program is not continuing in file 1 after the first hit. Any
suggestions?
Code: Select all
#! /u... |
Python DateUtil Converting string to a date and time
Question: I'm trying to convert a parameter of type string to a date time. I'm using the
dateUtil library
from dateutil import parser
myDate_string="2001/9/1 12:00:03"
dt = parser.parse(myDate_string,dayfirst=True)
print dt
every ti... |
Obtaining Client IP address from a WSGI app using Eventlet
Question: I'm currently writing a basic dispatch model server based on the Python
Eventlet library (http://eventlet.net/doc/). Having looked at the WSGI docs on
Eventlet (http://eventlet.net/doc/modules/wsgi.html), I can see that the
eventlet.wsgi.server functi... |
How-To - Update Live Running Python Application
Question: I have a python application , to be more precise a Network Application that
can't go down this means i can't kill the PID since it actually talks with
other servers and clients and so on ... many € per minute of downtime , you
know the usual 24/7 system.
Anyway... |
How to import data from scanned text into Django models
Question: I have a hundreds of pages of "quiz" questions, multiple-choice options and
associated answer keys and explanations. I'm trying to create a simple Django
app to administer these questions. I have created a simple but effective
Python parser to parse the ... |
Unable to import SimPy
Question: I am new to SimPy I used the easy_install to install SimPy module then on the
command line I simply tried `from SimPy.Simulation import *` but I get the
following error
Python 2.6.7 (r267:88850, Aug 22 2011, 14:13:38)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on da... |
Extend all occurences in a string in Python
Question: The goal is to prefix and suffix all occurrences of a substring (case-
insensitive) in a source string. I basically need to figure out how to get
from source_str to target_str.
source_str = 'You ARe probably familiaR with wildcard'
target_str = 'Y... |
What dose (.*) mean in python?
Question: I was reading a learning python book, and this was in one of the examples so I
was wonder if this meant something.
Answer: (.*) doesn't mean anything specific in Python. However, it can mean specific
things to certain functions when a part of a string. Hence `'(.*)'` might mea... |
Introspection on pygtk3 possible?
Question: One of the great things of python is the ability to have introspection on
methods and functions. As an example, to get the function signature of
`math.log` you can (in ipython) run this:
In [1]: math.log?
Type: builtin_function_or_method
Base Clas... |
Performance of scipy.weave.inline
Question: I am a Python novice who is trying to learn a bit about this fantastic
programming language. I have tried using scipy.weave.inline to speed up some
computation. Just to learn a bit, I tried to implement a matrix multiplication
using scipy.weave.inline. I have not included any... |
multiprocessing.Pool - PicklingError: Can't pickle <type 'thread.lock'>: attribute lookup thread.lock failed
Question: `multiprocessing.Pool` is driving me crazy...
I want to upgrade many packages, and for every one of them I have to check
whether there is a greater version or not. This is done by the `check_one`
fun... |
python memory leak
Question: I have an array of 'cell' objects created like so:
class Cell:
def __init__(self, index, type, color):
self.index = index
self.type = type
self.score = 0
self.x = index%grid_size
self.y = int(index/grid_size)
self.color = ... |
How would I write a syntax checker?
Question: I am interested in writing a syntax checker for a language. Basically what I
want to do is make a cli tool that will take an input file, and then write
errors that it finds. The language I would want to parse is basically similar
to Turing, and it is rather ugly and sometim... |
Mocking a function throughout a project
Question: I would like to [mock](http://pypi.python.org/pypi/mock) a certain function in
a utility module throughout my project, as part of a testing suite. I could of
course patch and mock this function for each module using it, but there are a
lot of these and it would be non-r... |
python setuptools installation in centos
Question: i have to install mysqldb module of python in my centos server. i have 2
versions of python
1. 2.4.3 the default one
2. 2.6 which i installed
i want to install mysqldb module for 2.6 version of the python. i installed it
from [here](http://ben.timby.com/?p=123) b... |
How do I poll the subversion history/log remotely from python?
Question: I need to find the first committer of a branch without having to do a checkout
of all the entire branches. From command line that is very easy to do:
svn log -v --stop-on-copy http://subversion.repository.com/svn/repositoryname
... |
Python 2.7: Print thread safe
Question: I've seen a similar post
[here](http://stackoverflow.com/questions/3029816/how-do-i-get-a-thread-safe-
print-in-python-2-6) however it refers to Python 2.6 and I was hoping there
was an easier way.
From reading the thread it seems the best way is to just replace all my print
sta... |
Using anchors in python regex to get exact match
Question: I need to validate a version number consisting of 'v' plus positive int, and
nothing else eg "v4", "v1004"
I have
import re
pattern = "\Av(?=\d+)\W"
m = re.match(pattern, "v303")
if m is None:
print "noMatch"
else:
... |
Why Does This Program Run on Linux Python Shell But Not on Windows?
Question: I ran this program on Linux with Python 2.6.2 and it ran fine returning me
with decimal values but when I run it on Python 2.7.2 on Windows it does not
work and just gives a blank space for a while and then a memory error but I
can't figure o... |
Copy data from the clipboard on Linux, Mac and Windows with a single Python script
Question: I am trying to create a script in Python that will collect data put in the
clipboard by the user and preferably save it as a list or in a text file or
string/array/variable to work with later on.
This should work on Linux all ... |
Another Token error: EOF in multi-line statement
Question: **The following code gives me this error "Token Error: EOF in multi-line
statement". I cannot seem to find the error though! Maybe someone else will
see it?**
import easygui
import time
namegui = easygui.enterbox(msg='Enter your name:', t... |
hadoop streaming: how to see application logs?
Question: I can see all hadoop logs on my `/usr/local/hadoop/logs` path
but where can I see application level logs? for example :
mapper.py
import logging
def main():
logging.info("starting map task now")
// -- do some task -- //
... |
How to install database with Spring MVC
Question: I've got a Spring MVC project which I've received from another developer. I
usually find .sql files there to initialize the DB, but this code doesn't seem
to have anything like that. I doesn't use Roo or any tools that I know that
can do database initialization.
I've b... |
popen3 and return code
Question: I want to get stdout and stderr of a command along with the return code. Can
someone point me to a python function that already accomplishes this?
I modified a function that I found on this site as follows -- but I am not
able to grab the return code of the command. In this snippet, st... |
The results of sha1 encryption are different between python and java
Question: An application, i need sha1 encryption,but the results are different between
python and java, java is correct. Because there is no byte object in python,
and java byte is used for hash calculation. How to get the correct results
with python?... |
What is the correct callback signature for a function called using ctypes in python?
Question: I have to define a callback function in Python, one that will be called from a
DLL.
BOOL setCallback (LONG nPort, void ( _stdcall *pFileRefDone) (DWORD nPort, DWORD nUser), DWORD nUser);
I tried this code... |
Passing Structure to Windows API in python ctypes
Question: I'm trying to set the date in a SysDateTimeObject in an application on Windows
7. I'm using python 2.7 and the ctypes library with the following code which
tries to send a DTM_SETSYSTEMTIME message to the SysDateTimeObject:
from ctypes import *
... |
finding absolute path from a relative path in python
Question: my question is pretty much what the title suggests. my research has led me to
try something like this:
import os
pathname = os.path.abspath("some/relative/directory")
print pathname
this problem is that whenever i do something l... |
How do I change a value while debugging python with pdb?
Question: I want to run pdb, step through the code, and at some point change the value
pointed at by some name. So I might want to change the value pointed at by the
name 'stationLat'. But it seems I can't. Here's the example:
>>> import extractPer... |
how can I input a file and run an asynchronously command on it in python?
Question: I'm trying to write a script that asks for an input file and then runs some
command on it. when I run the script it askes me for filename and when I give
the file (e.g example.bam) then I get this error:
> NameError: name 'example.bam'... |
ImportError: No module named lines
Question:
from lines import lines
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
import lines
ImportError: No module named lines
This is taken from [this](http://packages.python.org/pycha/examples.html)
example for Pyc... |
What is the recommended way to replace multiple strings in one large string in Python?
Question: I have many string pairs and one large string (which is the content of a
file). I need to replace each and every occurrence of the first member in each
pair with the respective second one.
For instance, having pairs ("AA",... |
How to tell if python's ZipFile.writestr() failed because file is full?
Question: Without using zip64 extensions, a Zip file cannot be more than 2GB in size, so
trying to write to a file that would put it over that limit won't work. I
expected that when such a writing was attempted, it would raise an exception,
but I'v... |
Manipulating a Python file from C#
Question: I'm working on some tools for a game I'm making. The tools serve as a front
end to making editing game files easier. Several of the files are python
scripting files. For instance, I have an Items.py file that contains the
following (minimalized for example)
fr... |
How to use SSL with Django app (deployed using mod_wsgi and virtualenv)
Question: Disclaimer: I don't really know what I'm doing, so I may have phrased things
wrong. I've also never asked/answered a question on here before!
I have a Django app running on Apache that I deployed using mod_wsgi and
virtualenv. I want som... |
How to define a chi2 value function for arbitrary function?
Question: I am doing some data fitting using the pyminuit Python bindings for the minuit
minimisation code (http://code.google.com/p/pyminuit/). The minimiser accepts
a function and uses introspection to extract the parameters to be minimised.
In general, I wa... |
namespace on python pickle
Question: I got an error when I use pickle with unittest.
I wrote 3 program files:
1. for a class to be pickled,
2. for a class which use class in #1,
3. unittest for testing class in #2.
and the real codes are as follows respectively.
#1. ClassToPickle.py
import pick... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.