[Tutor] How to install BeautifulSoup?

2010-10-29 Thread Richard D. Moores
64-bit Vista
Python 2.6.4

I just downloaded BeautifulSoup-3.0.8.1, which is a folder containing
setup.py. Does anyone know how to run setup,py?

I've already tried

C:\Python26\Lib\site-packages\BeautifulSoup-3.0.8.1setup.py
 File C:\Python26\Lib\site-packages\BeautifulSoup-3.0.8.1\setup.py, line
22
   print Unit tests have failed!

^

and

C:\Python26\Lib\site-packages\BeautifulSoup-3.0.8.1python setup.py
  File setup.py, line 22
print Unit tests have failed!
  ^

Thanks,

Dick Moores
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to install BeautifulSoup?

2010-10-29 Thread Richard D. Moores
On Thu, Oct 28, 2010 at 23:18, Abhijeet Rastogi abhijeet.1...@gmail.com wrote:

 In command prompt, do something like

 $python setup.py install

Yes, that did it. Thanks!

Dick
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] module for clustering

2010-10-29 Thread Bala subramanian
Friends,
I have X and Y points and i want to cluster these points in 2D space, Kindly
suggest if there is any module that is loaded with python to do that or any
other package for the same.

Thanks,
Bala
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] module for clustering

2010-10-29 Thread Wayne Werner
On Fri, Oct 29, 2010 at 4:45 AM, Bala subramanian bala.biophys...@gmail.com
 wrote:

 Friends,
 I have X and Y points and i want to cluster these points in 2D space,
 Kindly suggest if there is any module that is loaded with python to do that
 or any other package for the same.


matplotlib is pretty much amazing in that regard.

If you're using Windows, I highly suggest downloading Python(x,y) from
www.pythonxy.com - it's a package of python and other tools specifically
designed for scientific computing, and as the biophysics in your email
address suggests, I presume you will probably find many of the provided
tools very helpful. It includes matplotlib, which is the foremost graphing
module in Python that I know of, and is quite advanced, including capability
for 3d graphs.

HTH,
Wayne
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python: 27 times faster than bash

2010-10-29 Thread Sean Carolan
 Can we see a version of your script?

How about just a couple snippets...there's no proprietary data but I
want to be on the safe side.  The original script consisted of a bunch
of functions similar to the one below.  When I first wrote this I
didn't know how to use sed very well, so I used variable substitution
to strip out the data I wanted:

So this function in bash:

function gettomcatserver ()
{
# Strip out the short hostname
       remoteserver=$(grep remote.server.host $adminfile)
       remoteserver=${remoteserver##*=}
       remoteserver=${remoteserver%%.*}
       echo $remoteserver
}

Became this function in python:

def gettomcatserver( customername ):
   for line in open(adminfile).readlines():
       if line.startswith(remote.server.host=):
           return line.split(remote.server.host=)[1].split(.example.com)[0]

The total script runs several functions like this for each
$customername; I was quite impressed with the difference in speed.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] If statement isn't working

2010-10-29 Thread Susana Iraiis Delgado Rodriguez
Hello members:

I'm trying to validate the existence of a file by an if statement, but it
isn't working correctly. The module is a crawler that writes to excel some
attributes from the files it finds.

folders = None
 # look in this (root) folder for files with specified extension
for root, folders, files in os.walk( C:\\ ):
   file_list.extend(os.path.join(root,fi) for fi in files if
fi.endswith(.shp))
wrkbk = Workbook()
 #Add named parameter to allow overwriting cells: cell_overwrite_ok=True
wksht = wrkbk.add_sheet('shp')
#... add the headings to the columns
wksht.row(0).write(0,'ruta')
wksht.row(0).write(1,'archivo')
#write the rows
for row, filepath in enumerate(file_list, start=1):
  wksht.row(row).write(0, filepath)
 (ruta, filename) = os.path.split(filepath)
 wksht.row(row).write(1, filename)

#Here I`m splitting the string filename in base and extension
n = os.path.splitext(filename)
#Getting the base and prj as its extension
 p = n[0]+'.prj'
#validate if p exists
 if os.path.lexists(p):
  wksht.row(row).write(9, 1)
  prj_text = open(p, 'r').read()
  wksht.row(row).write(8,prj_text)
 else:
  wksht.row(row).write(9, 0)
  wksht.row(row).write(8, 'Sin prj, no se puede determinar la proyeccion')

The issue is that it just identifies 3 prj and I have more, befores I
added  prj_text = open(p, 'r').read()
  wksht.row(row).write(8,prj_text) it worked fine and write the correct prj,
but now it doesn't

What am I doing wrong? Hope you can help me
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (no subject)

2010-10-29 Thread Alan Gauld


Steven D'Aprano st...@pearwood.info wrote

is actually being executed. There are very few programming tasks 
harder than trying to debug code that doesn't actually contain any 
bugs, or contains bugs different from the ones you are seeing, 
because the code you are actually executing is something different 
from what you think you are executing.


To illustrate with a true story (back in the days when you had to 
build

and maintain your own compilers!):

Take a C compiler source code and modify it so it produces faulty
executable code but does not crash or otherwise report an error.
Compile the now faulty compiler source code with the old (ie working)
compiler.
Fix the source code bug.
Use the new (now broken) compiler to compile the now perfect source
code to produce a broken compiler with a slightly different defect.
Now use the resulting compiler to recompile the 'perfect' source code.
Now figure out why none of your executables work as expected.

That took us nearly 2 weeks to figure out... :-(
(And made us very thankful for source code version control!)

Alan G.




___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor