python

Apache mod_wsgi Django setup - Forbidden You don't have permission to access /mysite on this server

I have install python 26, Apache 2.2, modwsgi ap2.2 py26 On windows XP. and apache loads modwsgi fine. when I check localhost: apache says - It works! but when i try to open the Django directory mysite: localhost/mysite i get : Forbidden You don't have permission to access /mysite on this server. I have re-installed and installed this ma...

Where can I find a good mwclient introduction?

I'm just starting with mwclient. I'm going to create bots to query our MediaWiki database and make small revisions. But I cannot find anywhere a simple list of python commands like how to get ages of pages, contents of categories, contents of pages, etc. Does anyone know a good starters resource? ...

setting y-axis limit in matplotlib

Hi, I need help with setting the limits of y-axis on matplotlib. Here is the code that I tried, unsuccessfully. import matplotlib.pyplot as plt plt.figure(1, figsize = (8.5,11)) plt.suptitle('plot title') ax = [] aPlot = plt.subplot(321, axisbg = 'w', title = "Year 1") ax.append(aPlot) plt.plot(paramValues,plotDataPrice[0], color = '#...

i want a to resize an image but without distortion.

I have an image having dimension 1000*500 I want to make it of 400*300 But My image should not looked distorted. http://www.daniweb.com/forums/thread295652.html - i used this as a reference. But My image get distorted. ...

Prevent EpyDoc from truncating attribute lists?

I'm using EpyDoc (with reStructuredText) to document my Python project and produce HTML output. EpyDoc automatically truncates long lists of attributes in UML diagrams (generated with the --graph=umlclasstree option), helpfully placing a clickable ... marker that doesn't link to anything or seem to trigger any JavaScript events. For ex...

Is there a app or python package for managing background python script add,execute,stop ?

I want an app or python package that can 1.Dynamicly add python script to the background 2.Execute a specificed time 3.Check is this python script is running, 4.Also i can kill the current execute script. Is already has such package,so i needn't care about cron,at,check processing is running etc. Any advice is appreciated Cron on...

Django Form validation including the use of session data

The use case I am try to address is a requirement for a user to have downloaded a file before being permitted to proceed to the next stage in a form process. In order to achieve this, I have a Django Form to capture the user's general information which POSTS to Django view 'A'. The Form is displayed using a template which also includes ...

how to displace an image in python?

I have an image size 400*200. I have a frame size 400* 300. I want to put the image in the center of frame. That is my image cordinate (0,0) starts with the frame cordinates (0,50). ...

Python extensions for Win64 via GCC

Has anyone had any luck with compiling 64-bit Python extension modules for Windows using mingw64? I have successfully compiled the extension in question with VS2008 for this platform. I've also compiled it with mingw32 (with a 32-bit python). I would prefer both builds to use GCC. I've installed the mingw64-x86_64-w64 GCC 4.5.1 set of...

What Vim script you recommend for checking Python syntax on the fly ?

I have visited Vim website , script section and found several synthax checkers for python. But which one to choose ? I would prefer something that supports python 3 as well, even though I code in python 2.6 currently. Do all these checkers need a module like pychecker and pyflakes ? I could install the most popular from scripts datab...

Find all tags with a specific attribute value

How can I iterate over all tags which have a specific attribute with a specific value? For instance, let's say we need the data1, data2 etc... only. <html> <body> <invalid html here/> <dont care> ... </dont care> <invalid html here too/> <interesting attrib1="naah, it is not this"> ... </interesting t...

gearman python interface on mac

I'm trying to install gearman interface on mac os x 10.6.4 using python 2.4. so after doing ./configure --with-libgearman-prefix=/opt/local/ I'm getting: configure: error: Could not link test program to Python. Maybe the main Python library has been installed in some non-standard library path. If so, pass it to configure, vi...

why can't I fetch sql statements in python?

I have a very large table (374870 rows) and when I run the following code timestamps just ends up being a long int with the value 374870.... I want to be able to grab all the timestamps in the table... but all I get is a long int :S import MySQLdb db = MySQLdb.connect( host = "Some Host", user = "S...

What is the fastest way to read in a large data file of text columns?

Hello stackoverflow, I have a data file of almost 9 million lines (soon to be more than 500 million lines) and I'm looking for the fastest way to read it in. The five aligned columns are padded and separated by spaces, so I know where on each line to look for the two fields that I want. My Python routine takes 45 secs: import sys,time ...

Create Python array.array Object from cStringIO Object

I want to create an array.array object from a cStringIO object: import cStringIO, array s = """ <several lines of text> """ f = cStringIO.StringIO(s) a = array.array('c') a.fromfile(f, len(s)) But I get the following exception: Traceback (most recent call last): File "./myfile.py", line 22, in <modu...

Pre-interpret Django site at deployment time

I deploy Django apps using a fabric script that checks out a copy of my project and when everything is in place the source is symlinked and the web server is reloaded (guessing this is a typical approach). My concern is that the first time the site gets hit after deployment all the python scripts need to be re-interpreted. I have some ...

Loop thru a directory and seach in all pre-filtered XML files for a word

Hello everyone, I would like to loop thru a given directory and seach in all pre-filtered files for a search word. I prepared this code, but it is not looping thru all files, only the last file which was found is analyzed. Ideally all files should be analyzed and the output should be saved in a textfile. Could someone help? Thank you in...

Why does "python setup.py sdist" create unwanted "PROJECT-egg.info" in project root directory?

When I run python setup.py sdist it creates an sdist in my ./dist directory. This includes a "PROJECT-egg.info" file in the zip inside my "dist" folder, which I don't use, but it doesn't hurt me, so I just ignore it. My question is why does it also create a "PROJECT-egg.info" folder in my project root directory? Can I make it stop ...

Determining a file's path name from different working directories in python

Hi all- I have a python module that is shared among several of my projects (the projects each have a different working directory). One of the functions in this shared module, executes a script using os.spawn. The problem is, I'm not sure what pathname to give to os.spawn since I don't know what the current working directory will be wh...

subprocess.popen seems to fail when run from crontab

Hi All, probably a daft question but.... I'm running a script from crontab that will just ssh and run a command and store the results in a file. the function that seems to be failing is subprocess.popen Here is the function def _executeSSHCommand(sshcommand,user,node): ''' Simple function to execute an ssh command on a remo...