Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Hendrik van Rooyen
"Russ P."  wrote:

> I am surprised to see that Newton is not taken. I urge
> Guido to take it while it is still available. Sir Isaac
> certainly deserves the honor.

Does he?  Are you aware of how he treated Hooke?

He was a great technician, but as a person, you would
not have had him marry your sister.

- 1 on this silly "Newton" idea.

- Hendrik


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Hendrik van Rooyen
"John Machin" <[EMAIL PROTECTED]> wrote:


> On Dec 1, 5:14 pm, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote:
> >  "John Machin"  wrote:
> >
> > > Pythons are good snakes; they hypnotise the meaninglessly chattering
> > > bandarlog and eat them. Beware!
> >
> > What is a bandarlog - I know the bandersnatch and the boojum, but
> > bandarlog?
> 
> http://en.wikipedia.org/wiki/Bandar-log

Thanks - should have known that, have read Kipling, but
seems that too much Alzheimer's Light has done for me.

- Hendrik

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: using pdb and catching exception

2007-12-01 Thread Frank Millman


Amit Gupta wrote:
> Py'ites
>
> I am using pdb to check my code, and I would like to put a statement
> like equivalent of "C++gdb>catch throw".
>
> Basically, I would like debugger to start as soon as an exception is
> thrown. How may I do it?
>
>
> Thanks

See this post from less than a week ago.

http://tinyurl.com/2zyr7u

I think that the message from Diez B. Roggisch has what you are
looking for.

Frank Millman
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] minimalist web server

2007-12-01 Thread Paul Rubin
> from SimpleHTTPServer import SimpleRequestHandler
> handler = HTTPServer (('', 8000), SimpleRequestHandler)


I think you mean SimpleHTTPRequestHandler.  Note that actually reads
the url path and looks in the file system to get the file of that
name, which isn't what the OP wanted.

The OP might also try the junkbuster proxy (google for it) which I
think was renamed a while back.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] minimalist web server

2007-12-01 Thread Mel
Daniel Fetchinson wrote:
> Maybe I found what I'm looking for: cheetah, a web server that is 600
> lines of C code and that's it :)
> 
> http://freshmeat.net/projects/cheetahd/

For the sake of on-topicness, there is this:



#!/usr/bin/env python
# -*- coding: ASCII -*-
'''$Id$
'''
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleRequestHandler

handler = HTTPServer (('', 8000), SimpleRequestHandler)
handler.handle_forever()



Mel.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Gnu/Linux dialogue boxes in python

2007-12-01 Thread Donn Ingle
Paul Boddie wrote:
> but I'll
> either upload a new release, or I'll make the code available
> separately.

Thanks, give me a shout when you do -- if you remember!

\d

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Show this file in explorer"

2007-12-01 Thread farsheed
You are my hero man, Thanks a lot.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] minimalist web server

2007-12-01 Thread Dave Benjamin
Daniel Fetchinson wrote:
> The reason I need this is that my current best strategy to avoid ads
> in web pages is putting all ad server names into /etc/hosts and stick
> my local ip number next to them (127.0.0.1) so every ad request goes
> to my machine. I run apache which has an empty page for 404 errors so
> I'll just see that blank page for every ad. Now I guess apache is a
> pretty heavy weight guy so I'm looking for a lightweight alternative.
> Lighttpd, nginx and company are all too complex and "know" too much. I
> even considered just putting netcat into an infinite loop but I'm
> afraid if there is a security hole in netcat I might be screwed.

I don't know if this qualifies as "lightweight", but my current best 
strategy is to block ads using a Squid proxy. My /etc/squid/squid.conf has:

acl ads dstdom_regex -i "/etc/squid/squid.adservers"
http_access deny ads
deny_info javascript:void(0) ads

/etc/squid/squid.adservers came from this site:
http://pgl.yoyo.org/adservers/

Ads completely disappear with no visible errors or unnecessary HTTP 
requests. (Sorry, no Python needed for this one.)

Dave
-- 
http://mail.python.org/mailman/listinfo/python-list


ANN: Pyrex 0.9.6.4

2007-12-01 Thread Greg Ewing
Pyrex 0.9.6.4 is now available:

   http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/

Mostly just bug fixes in this release; see CHANGES.txt on
the web site for details.


What is Pyrex?
--

Pyrex is a language for writing Python extension modules.
It lets you freely mix operations on Python and C data, with
all Python reference counting and error checking handled
automatically.
-- 
http://mail.python.org/mailman/listinfo/python-list


Computer Security Information and What You Can Do To Keep Your System Safe!

2007-12-01 Thread Anand . Bhaskar . group . com
.:: Unix and Linux Hacking and Security ::.
1. Unix - Vulnerabilities and Advisories
-- Tutorials and Papers
-- Specific Exploits and Vulnerabilities

2. Unix - Security Tools
-- Unix Security and Audit Tools (Including IDS and Access Control
Tools)
-- Unix Log Analysis Tools
-- Unix Proxies, Firewalls and Accessories
-- Unix Miscellany

3. Unix - BSD, FreeBSD, etc...
-- FreeBSD
-- BSD and Misc. BSD variants
-- BSD Security Tools
-- BSD Micro-distributions

4. Unix - Solaris, SunOS etc...
-- Solaris
-- SunOS
-- Cobalt Appliances
-- SunOS and Solaris Security Tools

5. Unix - Other Flavors (Irix, HPUX, AIX, etc...)
-- SGI/Irix
-- HP-UX
-- AIX
-- SCO
-- Miscellaneous

6. Linux - Vulnerabilities and Advisories
-- Linux - General Hacking
-- Linux Application Exploits
-- Linux - Red Hat Specific
-- Linux - Debian Specific

7. Linux - Security Tools
-- Linux - Intrusion Detection
-- Linux - Access Control
-- Linux Log Analysis Tools
-- Linux Rootkits
-- Linux Proxies and Firewalls
-- Linux - General Security and Audit Tools

8. Linux - Security-oriented mini- and micro-distributions
-- DMZS-Biatchux
-- NSA Security Enhanced Linux
-- Linux Mini- and Micro-distributions
-- Applications

.:: Windows Hacking and Security ::.
1. Windows Vulnerabilities, Advisories, and even security flaws
introduced by so-called security products!!!
-- Microsoft IIS Vulnerabilities
-- Microsoft FrontPage Vulnerabilities
-- Microsoft Internet Explorer Vulnerabilities
-- Windows Application Vulnerabilities
-- Windows Internet/Networking Vulnerabilities
-- Insecurities introduced by "security" programs!
-- Netscape Browsers
-- Windows Hacks - Miscellaneous

2. Windows Security and Auditing Tools
-- Windows Registry Tools
-- Windows and MSDOS Security and Auditing Tools
-- Windows Local Security
-- File/Disk/Log Shredders

3. Windows Miscellany
-- Raw Sockets and Custom Packet Building
-- A Few Little Extras for Microsoft "Fans"

.:: Crypto, Virology, Cracking and Backdoors ::.
1. Cryptography, Cryptanalysis, Steganography
-- Crypto: PGP and GPG
-- Crypto: Cryptanalysis
-- Crypto: Steganography
-- Crypto: Miscellaneous
-- Misc. File Encryptors

2. About Viruses and Worms
-- Virus Info Files and Advisories
-- Worms
-- Virus/Worm Protection Utilities

3. Backdoors, Trojans and defenses
-- Back Orifice and BO2K
-- SubSeven and Addons
-- Other Remote Administration Tools
-- Trojan Detectors/Removers/Retaliators
-- Information Files

.:: Learn what Hackers know, how they do it, and what you can do to
keep your system safe ::.
1. General Hacking Information
-- General Security Concepts
-- Antique Systems
-- Oracle
-- Tools, Advisories and Exploits affecting multiple platforms
-- PC Software and BIOS Hacking
-- Truly Miscellaneous Hacking Info

2. Password Security
-- Password Hacking
-- Password Generators
-- Password Security Audit Programs
-- Word Lists

3. Scanning, Fingerprinting and similar techniques
-- Network Scanning
-- "Wargames" Modem Carrier Scanning
-- Fingerprinting
-- Sniffing

4. How Hackers Attack Numerous Internet Services
-- Denial of Service Attacks
-- Email and News
-- Proxies and IP Spoofing
-- DNS and BIND
-- SPAM
-- FTP
-- General Unsorted Information
-- Indispensible Internet Utilities
-- Cable and DSL Info and Hacking

5. How Hackers Attack Web Servers, CGIs, PHP, ASP, etc...
-- Web Site Hacking - General and Miscellaneous
-- Web Site Hacking - Specific Sites
-- Web Site Hacking - Servers
-- Web Site Hacking - CGI, Perl, ASP, PHP etc.
-- Web BBSes
-- Web Site Hacking - Audit Tools

6. How Hackers attack IRC, Instant Messaging, and Multiplayer Games
-- ICQ Hacking
-- IRC Hacking, Scripts and Bots
-- AOL Instant Messenger (AIM)
-- Miscellaneous Chat/gaming Systems

7. Vulnerabilities found in Platforms with Smaller Market Share
-- Macintosh
-- PalmOS
-- Printers
-- Dedicated Network Appliances, Hubs, Routers, etc...
-- Cisco Equipment
-- Miscellaneous

8. How Hackers Attack Novell and 802.11b Networks
-- Novell Networks
-- Wireless LANs
-- X.25 Networks
-- Miscellaneous Networking Information

.:: Computer Security Information ::.
-- Access Control
-- Basics
-- Chat Systems
-- Cryptography
-- Denial Of Service
-- Hacking Security Groups
-- Hardening Securing Papers
-- ICQ
-- Intrusion Detection Systems
-- IRC
-- Miscellaneous
-- Network Auditing Secuirty Penetration
-- Online Privacy
-- Operating Systems
-- Protocols

.:: Phreaking - The black art of telephony ::.
1. GENERAL - General Information About the Phone Company
-- Hacking Answering Machines and Voice Mail
-- Phreaking Programs

2. Electronic Toll Fraud and Other Phone Devices
-- The Fixer's Box Review - Read this before you read the rest of
these files!
-- Blue and Green Boxes
-- Red Box
-- Beige and Bridge Boxes
-- Various new boxes
-- Programs to generate phreak tones

3. All about Payphones, COCOTs, BOCOTs, etc...
-- Payphones
-- COCOTs
-- Nortel/Quortech Millennium
-- Smart Cards/Phone Cards

4. Cellular Telephones and the Hacking Thereof
-- Cellular Phones

my first screen scraper

2007-12-01 Thread [EMAIL PROTECTED]
##  I was looking in my database of movie grosses I regulary copy
##  from the Internet Movie Database and noticed I was _only_ 120
##  weeks behind in my updates.
##
##  Ouch.
##
##  Copying a web page, pasting into a text file, running a perl
##  script to convert it into a csv file and manually importing it
##  into Access isn't so bad when you only have a couple to do at
##  a time. Still, it's a labor intensive process and 120 isn't
##  anything to look forwards to.
##
##  But I abandoned perl years ago when I took up Python, so I
##  can use Python to completely automate the process now.
##
##  Just have to figure out how.
##
##  There's 3 main tasks: capture the web page, parse the web page
##  to extract the data and insert the data into the database.
##
##  But I only know how to do the last step, using the odnc tools
##  from win32,

import dbi
import odbc
import re

##  so I snoop around comp.lang.python to pick up some
##  hints and keywords on how to do the other two tasks.
##
##  Documentation on urllib2 was a bit vague, but got the web page
##  after only a ouple mis-steps.

import urllib2

##  Unfortunately, HTMLParser remained beyond my grasp (is it
##  my imagination or is the quality of the examples in the
##  doumentation inversely proportional to the subject
##  difficulty?)
##
##  Luckily, my bag of hints had a reference to Beautiful Soup,
##  whose web site proclaims:
##  Beautiful Soup is a Python HTML/XML parser
##  designed for quick turnaround projects like
##  screen-scraping.
##  Looks like just what I need, maybe I can figure it out after all.

from BeautifulSoup import BeautifulSoup

target_dates = [['11','24','2006','November']]

con = odbc.odbc("IMDB")  # connect to MS-Access database
cursor = con.cursor()

for d in target_dates:
  #
  # build url (with CGI parameters) from list of dates needing
updating
  #
  the_year = d[2]
  the_date = '/'.join([d[0],d[1],d[2]])
  print '%10s scraping IMDB:'  % (the_date),
  the_url = ''.join([r'http://www.imdb.com/BusinessThisDay?
day=',d[1],'&month=',d[3]])
  req = urllib2.Request(url=the_url)
  f = urllib2.urlopen(req)
  www = f.read()
  #
  # ok, page captured. now make a BeatifulSoup object from it
  #
  soup = BeautifulSoup(www)
  #
  # that was easy, much more so than HTMLParser
  #
  # now, _all_ I have to do is figure out how to parse it
  #
  # ouch again. this is a lot harder than it looks in the
  # documentation. I need to get the data from cells of a
  # table nested inside another table and that's hard to
  # extrapolate from the examples showing how to find all
  # the comments on a web page.
  #
  # but this looks promising. if I grab all the table rows
  # (tr tags), each complete nested table is inside a cell
  # of the outer table (whose table tags are lost, but aren't
  # needed and whose absence makes extracting the nested
  # tables easier (when you do it the stupid way, but hey,
  # it works, so I'm sticking with it))
  #
  tr = soup.tr  # table rows
  tr.extract()
  #
  # now, I only want the third nested table. how do I get it?
  # can't seem to get past the first one, should I be using
  # NextSibling or something? 
  #
  # but wait...I don't need the first two tables, so I can
  # simply extract and discard them. and since .extract()
  # CUTS the tables, after two extractions the table I want
  # IS the first one.
  #
  the_table = tr.find('table')  # discard
  the_table.extract()
  the_table = tr.find('table')  # discard
  the_table.extract()
  the_table = tr.find('table')  # weekly gross
  the_table.extract()
  #
  # of course, the data doesn't start in the first row,
  # there's formatting, header rows, etc. looks like it starts
  # in tr number [3]
  #
  ##  >>> the_table.contents[3].td
  ##  How the Grinch Stole Christmas
(2000) 
  #
  # and since tags always imply the first one, the above
  # is equivalent to
  #
  ##  >>> the_table.contents[3].contents[0]
  ##  How the Grinch Stole Christmas
(2000) 
  #
  # and since the title is the first of three cells, the
  # reporting year is
  #
  ##  >>> the_table.contents[3].contents[1]
  ##   2001 
  #
  # finally, the 3rd cell must contain the gross
  #
  ##  >>> the_table.contents[3].contents[2]
  ##   259,674,120
  #
  # but the contents of the first two cells are anchor tags.
  # to get the actual title string, I need the contents of the
  # contents. but that's not exactly what I want either,
  # I don't want a list, I need a string. and the string isn't
  # always in the same place in the list
  #
  # summarizing, what I need is
  #
  ##  print the_table.contents[3].contents[0].contents[0].contents,
  ##  print the_table.contents[3].contents[1].contents[1].contents,
  ##  print the_table.contents[3].contents[2].contents
  #
  # and that almost works, just a couple more tweaks and I can
  # shove it into the database

  parsed = []

  for rec in the_table.contents[3:]:
the_rec_type = type(rec)

Re: [OT] minimalist web server

2007-12-01 Thread David Tweet
Running this in Python should create a server running on localhost
port 80 that only serves blank pages:

import SimpleHTTPServer
import SocketServer

class MyHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
  def do_GET(self):
print >> self.wfile, ""

server = SocketServer.TCPServer(("", 80), MyHandler)
server.serve_forever()

(also see http://effbot.org/librarybook/simplehttpserver.htm)

On Dec 1, 2007 7:02 PM, Daniel Fetchinson <[EMAIL PROTECTED]> wrote:
> > > I'm looking for the most minimalist web server ever that does nothing
> > > else than return a fixed static page for every request. Regardless of
> > > what the request is, it just needs to be an HTTP request to port 80,
> > > the web server should return always the same html document. What would
> > > be the best choice for this? The goal is of course to minimize system
> > > resources in terms of memory, cpu, etc, etc.
> >
> > If you're running linux, maybe you want tux.
> >
> > publicfile isn't exactly what you describe, but its description might
> > be of some interest:
> >
> > http://cr.yp.to/publicfile.html
>
>
> Thanks, tux looks good, the only problem is that one needs to
> recompile the kernel which I really don't want to do (so yes, I'm on
> linux). Publicfile seems to "know" already too much.
>
> The reason I need this is that my current best strategy to avoid ads
> in web pages is putting all ad server names into /etc/hosts and stick
> my local ip number next to them (127.0.0.1) so every ad request goes
> to my machine. I run apache which has an empty page for 404 errors so
> I'll just see that blank page for every ad. Now I guess apache is a
> pretty heavy weight guy so I'm looking for a lightweight alternative.
> Lighttpd, nginx and company are all too complex and "know" too much. I
> even considered just putting netcat into an infinite loop but I'm
> afraid if there is a security hole in netcat I might be screwed.
>
> Maybe now that I outlined a little more why I need this others can
> come up with more suggestions.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
-David
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] minimalist web server

2007-12-01 Thread Daniel Fetchinson
Maybe I found what I'm looking for: cheetah, a web server that is 600
lines of C code and that's it :)

http://freshmeat.net/projects/cheetahd/


On 12/1/07, Daniel Fetchinson <[EMAIL PROTECTED]> wrote:
> > > I'm looking for the most minimalist web server ever that does nothing
> > > else than return a fixed static page for every request. Regardless of
> > > what the request is, it just needs to be an HTTP request to port 80,
> > > the web server should return always the same html document. What would
> > > be the best choice for this? The goal is of course to minimize system
> > > resources in terms of memory, cpu, etc, etc.
> >
> > If you're running linux, maybe you want tux.
> >
> > publicfile isn't exactly what you describe, but its description might
> > be of some interest:
> >
> > http://cr.yp.to/publicfile.html
>
>
> Thanks, tux looks good, the only problem is that one needs to
> recompile the kernel which I really don't want to do (so yes, I'm on
> linux). Publicfile seems to "know" already too much.
>
> The reason I need this is that my current best strategy to avoid ads
> in web pages is putting all ad server names into /etc/hosts and stick
> my local ip number next to them (127.0.0.1) so every ad request goes
> to my machine. I run apache which has an empty page for 404 errors so
> I'll just see that blank page for every ad. Now I guess apache is a
> pretty heavy weight guy so I'm looking for a lightweight alternative.
> Lighttpd, nginx and company are all too complex and "know" too much. I
> even considered just putting netcat into an infinite loop but I'm
> afraid if there is a security hole in netcat I might be screwed.
>
> Maybe now that I outlined a little more why I need this others can
> come up with more suggestions.
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread George Sakkis
On Dec 1, 9:06 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:

> Pythons are big, non-poisonous snakes good for keeping the rats out
> of a system 

I'm looking forward to Spider(TM), the first bug-free language ;-)
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] minimalist web server

2007-12-01 Thread Daniel Fetchinson
> > I'm looking for the most minimalist web server ever that does nothing
> > else than return a fixed static page for every request. Regardless of
> > what the request is, it just needs to be an HTTP request to port 80,
> > the web server should return always the same html document. What would
> > be the best choice for this? The goal is of course to minimize system
> > resources in terms of memory, cpu, etc, etc.
>
> If you're running linux, maybe you want tux.
>
> publicfile isn't exactly what you describe, but its description might
> be of some interest:
>
> http://cr.yp.to/publicfile.html


Thanks, tux looks good, the only problem is that one needs to
recompile the kernel which I really don't want to do (so yes, I'm on
linux). Publicfile seems to "know" already too much.

The reason I need this is that my current best strategy to avoid ads
in web pages is putting all ad server names into /etc/hosts and stick
my local ip number next to them (127.0.0.1) so every ad request goes
to my machine. I run apache which has an empty page for 404 errors so
I'll just see that blank page for every ad. Now I guess apache is a
pretty heavy weight guy so I'm looking for a lightweight alternative.
Lighttpd, nginx and company are all too complex and "know" too much. I
even considered just putting netcat into an infinite loop but I'm
afraid if there is a security hole in netcat I might be screwed.

Maybe now that I outlined a little more why I need this others can
come up with more suggestions.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Russ P.

> Heck, lots of names are 
> take:http://en.wikipedia.org/wiki/Alphabetical_list_of_programming_languages

I am surprised to see that Newton is not taken. I urge
Guido to take it while it is still available. Sir Isaac
certainly deserves the honor.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: CoCoPy Beta released

2007-12-01 Thread Terry Reedy

"Ron Provost" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
|   VARS = [ 0 for x in xrange( 0, 1000 ) ]   # Create an array to hold the

This is the same as [0]*1000
which is faster to write, read, (and run). 



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] minimalist web server

2007-12-01 Thread Paul Rubin
"Daniel Fetchinson" <[EMAIL PROTECTED]> writes:
> I'm looking for the most minimalist web server ever that does nothing
> else than return a fixed static page for every request. Regardless of
> what the request is, it just needs to be an HTTP request to port 80,
> the web server should return always the same html document. What would
> be the best choice for this? The goal is of course to minimize system
> resources in terms of memory, cpu, etc, etc.

If you're running linux, maybe you want tux.

publicfile isn't exactly what you describe, but its description might
be of some interest:

http://cr.yp.to/publicfile.html
-- 
http://mail.python.org/mailman/listinfo/python-list


Tkinter container frames

2007-12-01 Thread Ron Provost
I've been trying to figure out how to use the container option in a frame 
widget in conjunction with the use option with a Toplevel widget.  Which 
according to the documentation I've read sounds like it will give me a Windows 
MDI like application with free-floating child windows within the container 
widget.  Has anyone successfully used this feature?  Here's the code I've been 
playing with.

Thanks for any help.



import Tkinter as Tk


tkRoot = Tk.Tk( )
f = Tk.Frame( tkRoot, container=True )
f.pack( )

t1 = Tk.Toplevel( use=f )
b1  = Tk.Button( t1, text="Pres me" )
b1.pack( )

t2 = Tk.Toplevel( use=f )
b2  = Tk.Button( t2, text="No pres me!" )
b2.pack( )


tkRoot.mainloop( )

-- 
http://mail.python.org/mailman/listinfo/python-list

[OT] minimalist web server

2007-12-01 Thread Daniel Fetchinson
Hi list,

This is way off topic but maybe somebody knowledgeable can help.

I'm looking for the most minimalist web server ever that does nothing
else than return a fixed static page for every request. Regardless of
what the request is, it just needs to be an HTTP request to port 80,
the web server should return always the same html document. What would
be the best choice for this? The goal is of course to minimize system
resources in terms of memory, cpu, etc, etc.

Cheers,
Daniel
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Russ P.
On Dec 1, 4:57 pm, Bjoern Schliessmann  wrote:
> Tóth Csaba wrote:
> > Lets evaluate from the Python3000: Newton3 (N3).
>
> > +1 vote from me :)
>
> Nah.

Python is an "acceptable" name, but Newton1 (or Newton3) would be a
great name. Shouldn't a great language have a great name? I think so.
And I think Python3000 is a great opportunity to give it a great name.

Of course, if Guido disagrees, I can always use

alias newton=python

Ah, the wonder of unix.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python newbie - question about lexical scoping

2007-12-01 Thread Matt Barnicle
>> On Dec 1, 4:47 pm, Matt Barnicle <[EMAIL PROTECTED]> wrote:
> aye yaye aye...  thanks for the pointers in the right direction..  i
> fiddled around with the code for a while and now i've reduced it to the
> *real* issue...  i have a class dict variable that apparently holds its
> value across instantiations of new objects..  the problem can be
> illustrated in the following much simpler code:
>
 class foo():
> ... bar = { 'baz': 'bing' }
> ...
 a = foo()
 a.bar
> {'baz': 'bing'}
 a.bar['baz'] = 'bong'
 a.bar
> {'baz': 'bong'}
 b = foo()
 b.bar
> {'baz': 'bong'}

ok, i see...  python has a concept i'm not accustomed to which i found
described here:

http://zephyrfalcon.org/labs/python_pitfalls.html
4. Class attributes vs instance attributes

so i'm sure what is going on is obvious to experienced python
programmers...  i'm not really sure how to get around this though.  i'll
need to spend some time on reworking our models code i guess...  i
inherited this from someone, and what he was trying to do was to set
default values for objects representing tables (in kind of a simple ORM
layer) and storing the values in a dict, and when the object is
instantiated, the table is queried and the default dict values are
overwritten.  so obviously this method is not going to work as such..

sorry for the misdirection, i didn't quite understand at first..

- m@

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python newbie - question about lexical scoping

2007-12-01 Thread Matt Barnicle
>> On Dec 1, 4:47 pm, Matt Barnicle <[EMAIL PROTECTED]> wrote:
> aye yaye aye...  thanks for the pointers in the right direction..  i
> fiddled around with the code for a while and now i've reduced it to the
> *real* issue...  i have a class dict variable that apparently holds its
> value across instantiations of new objects..  the problem can be
> illustrated in the following much simpler code:
>
 class foo():
> ... bar = { 'baz': 'bing' }
> ...
 a = foo()
 a.bar
> {'baz': 'bing'}
 a.bar['baz'] = 'bong'
 a.bar
> {'baz': 'bong'}
 b = foo()
 b.bar
> {'baz': 'bong'}

ok, i see...  python has a concept i'm not accustomed to which i found
described here:

http://zephyrfalcon.org/labs/python_pitfalls.html
4. Class attributes vs instance attributes

so i'm sure what is going on is obvious to experienced python
programmers...  i'm not really sure how to get around this though.  i'll
need to spend some time on reworking our models code i guess...  i
inherited this from someone, and what he was trying to do was to set
default values for objects representing tables (in kind of a simple ORM
layer) and storing the values in a dict, and when the object is
instantiated, the table is queried and the default dict values are
overwritten.  so obviously this method is not going to work as such..

sorry for the misdirection, i didn't quite understand at first..

- m@

-- 
http://mail.python.org/mailman/listinfo/python-list


Multiple Windows in Pygame, using true concurrency in python via Kamaelia

2007-12-01 Thread Michael Sparks
Hi,


Just thought some people may be interested to hear that I've recently been
looking at adding true concurrency into Kamaelia, by using Paul Boddie's
pprocess as the core mechanism to allow us to run multiple Kamaelia systems
in the same app. (Since we have thread based, and co-operative generator
based components, process based is the next logical step)

   [1] http://kamaelia.sourceforge.net/Home
   [2] http://pypi.python.org/pypi/pprocess

Anyhow, first proof of concept is to take a _relatively_ non-trivial app and
a library hostile to being run in a single process and run it across
multiple processes trivially. (I can't test multicpu since I don't have a
multicpu machine, but this should work fine with a modern OS)

So the app I've chosen is a simple pygame based drawing/doodling app, and to
get it to launch 8 pygame windows from 1 app. Since neither SDL nor pygame
directly support this it struck me as not just a visible proof of concept,
but a useful one too (since pygame rocks! :-)

Anyhow, I've written up the code here and posted a screenshot here:
   http://yeoldeclue.com/cgi-bin/blog/blog.cgi?rm=viewpost&nodeid=1196129474

You'll note 8 pygame windows ... :-)

The original base test is here:
   http://yeoldeclue.com/cgi-bin/blog/blog.cgi?rm=viewpost&nodeid=1196029230

For those curious who don't like clicking on links, the code needed to allow
the 8 pygame windows looks like this:

  class SecondProcessBasedComponent(SimplestProcessComponent):
def main(self):
from Kamaelia.UI.Pygame.Display import PygameDisplay
from Kamaelia.UI.Pygame.MagnaDoodle import MagnaDoodle

X=PygameDisplay(width=200,height=200).activate()
PygameDisplay.setDisplayService(X)
MagnaDoodle().run()
yield 1

  exchange = SecondProcessBasedComponent().activate()
  R = []
  for _ in xrange(7):
 R.append(SecondProcessBasedComponent().activate())

So far, so good :-)

Incidentally, yes the project is alive and well, but a resource crunch
at work means I'm working on this only on my own time at the mo, which
means things like releases are having a longer cycle between them than
I'd like. Some recent developments include a greylisting proxy server,
a ER modelling tool and a (very) simple pygame based logo like tool for
teaching programming to small children. The webserver is aiming for WSGI
compliance, and the project also had a small number of students working
over the summer, assisting with some useful things like AIM/IRC integration,
the ability to use Kamaelia systems in non-Kamaelia based scripts/systems,
and looking at a sub-component model. (ie non-concurrent systems)


Michael.
--
http://yeoldeclue.com/blog
http://kamaelia.sourceforge.net/Home

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python newbie - question about lexical scoping

2007-12-01 Thread Tim Roberts
Matt Barnicle <[EMAIL PROTECTED]> wrote:

>hi everyone..  i've been chugging along learning python for a few months 
>now and getting answers to all needed questions on my own, but this one 
>i can't figure out nor can i find information on the internet about it, 
>possibly because i don't understand the right words to type into google..
>
>i have a very common scenario and need to know the python way to do it.  
>take this example loop:
>
>comments = []
>for row in rows:
>comment = models.comment()
>comment.author = row[1]
>comment.text = row[0]
>comments.append(comment)
>
>the problem is that when i go to retrieve the comments later, they are 
>all the same object!  i assume this is due to there being no lexical 
>scoping?  so what is the solution to this?

Is that REALLY what the code looks like?  Or does it actually look like
this:

  comments = []
  comment = models.comment()
  for row in rows:
  comment.author = row[1]
  comment.text = row[0]
  comments.append(comment)

That construct would produce exactly the result you describe.  You would
also get the result you describe if models.comment() were a normal function
that returns a single object, instead of a class name, as I have assumed.
-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Bjoern Schliessmann
Tóth Csaba wrote:

> Lets evaluate from the Python3000: Newton3 (N3).
> 
> +1 vote from me :)

Nah.

BTW, why exactly do you keep using an X-Face header completely
identical to mine?

Regards,


Björn

-- 
BOFH excuse #364:

Sand fleas eating the Internet cables

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: pythonw.exe and python.exe

2007-12-01 Thread Tim Roberts
whatazor <[EMAIL PROTECTED]> wrote:
>
>I made a little application with multithreading in winxp with
>python2.5. An event generated from a third part software is the
>trigger for the creation of progress bar in a wxPython app. This
>python app is launched via wxExecute.
>I've noticed a different behaviour if the script is launched with
>python.exe  and  pythonw.exe (i.e. without dos shell), in fact in the
>first case it's all ok, while in the other case only the first, the
>third , the fifth  ... progress bar is setted correctly and update its
>value.
>Now, before control again the code , what can be the origin of the
>problem? why python and pythonw give a result so different?

There is not nearly enough information for us to diagnose the problem here.
Note, however, that in Windows, all GUI stuff must be done from the main
thread, because that's where window events are delivered.
-- 
Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to read strings cantaining escape character from a file and use it as escape sequences?

2007-12-01 Thread Bjoern Schliessmann
John Machin wrote:

> Amazing what you can find in obscure corners of the obscure docs!
> BTW, how many folks know what "bijective" means ?

Everyone that can read and is smart enough to enter "bijective" into
Wikipedia search.
 
Regards,


Björn

-- 
BOFH excuse #25:

Decreasing electron flux

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread greg
Dotan Cohen wrote:
> C++ is obviously C+1, ie, what comes after C.

Although it was a bit rude to choose the destructive form
C++ instead of C+1. Many programmers are quite happy with
C as it is and don't want their language overwritten!

Also there's the rather confusing fact that the value of
the expression C++ is actually C. So when using C++ you
only get to take away the old language, and you have to
leave the new one behind in its place...

--
Greg
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python newbie - question about lexical scoping

2007-12-01 Thread Matt Barnicle
> On Dec 1, 4:47 pm, Matt Barnicle <[EMAIL PROTECTED]> wrote:
>> hi everyone..  i've been chugging along learning python for a few months
>> now and getting answers to all needed questions on my own, but this one
>> i can't figure out nor can i find information on the internet about it,
>> possibly because i don't understand the right words to type into
>> google..
>>
>> i have a very common scenario and need to know the python way to do it.
>> take this example loop:
>>
>> comments = []
>> for row in rows:
>> comment = models.comment()
>
> Insert here:
>   print type(comment), id(comment), repr(row[:2])
>
>> comment.author = row[1]
>> comment.text = row[0]
>> comments.append(comment)
>>
>> the problem is that when i go to retrieve the comments later, they are
>> all the same object!  i assume this is due to there being no lexical
>> scoping?  so what is the solution to this?
>
> And the attributes of the "same object" match the first two elements
> of which input row:
> (a) rows[0]
> (b) rows[-1]
> (c) some other row
> (d) you can't tell because all input rows have the same value in each
> of row[0] and row[1]
> (e) none of the above?
>
> It's nothing to do with lexical scoping, at least in the code that
> you've shown us, which has no apparent problems. You need to show us
> the code for the models.comment function/method/class. Possibly it is
> returning the same object each time it is invoked (answer (b) above);
> the above print statement will help investigate that possibility, plus
> the possibility that the objects are not the same objects, but are
> different objects with the same attributes (answer (d) above). Also
> show us the code for retrieving the comments later; possibly you are
> retrieving the same element of the comments list each time. Use this:
> print [id(x) for x in comments]
> to verify your assertion that they are all the same object.
>
> Cheers,
> John

aye yaye aye...  thanks for the pointers in the right direction..  i
fiddled around with the code for a while and now i've reduced it to the
*real* issue...  i have a class dict variable that apparently holds its
value across instantiations of new objects..  the problem can be
illustrated in the following much simpler code:

>>> class foo():
... bar = { 'baz': 'bing' }
...
>>> a = foo()
>>> a.bar
{'baz': 'bing'}
>>> a.bar['baz'] = 'bong'
>>> a.bar
{'baz': 'bong'}
>>> b = foo()
>>> b.bar
{'baz': 'bong'}


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python newbie - question about lexical scoping

2007-12-01 Thread Matt Barnicle
> On Dec 1, 4:47 pm, Matt Barnicle <[EMAIL PROTECTED]> wrote:
>> hi everyone..  i've been chugging along learning python for a few months
>> now and getting answers to all needed questions on my own, but this one
>> i can't figure out nor can i find information on the internet about it,
>> possibly because i don't understand the right words to type into
>> google..
>>
>> i have a very common scenario and need to know the python way to do it.
>> take this example loop:
>>
>> comments = []
>> for row in rows:
>> comment = models.comment()
>
> Insert here:
>   print type(comment), id(comment), repr(row[:2])
>
>> comment.author = row[1]
>> comment.text = row[0]
>> comments.append(comment)
>>
>> the problem is that when i go to retrieve the comments later, they are
>> all the same object!  i assume this is due to there being no lexical
>> scoping?  so what is the solution to this?
>
> And the attributes of the "same object" match the first two elements
> of which input row:
> (a) rows[0]
> (b) rows[-1]
> (c) some other row
> (d) you can't tell because all input rows have the same value in each
> of row[0] and row[1]
> (e) none of the above?
>
> It's nothing to do with lexical scoping, at least in the code that
> you've shown us, which has no apparent problems. You need to show us
> the code for the models.comment function/method/class. Possibly it is
> returning the same object each time it is invoked (answer (b) above);
> the above print statement will help investigate that possibility, plus
> the possibility that the objects are not the same objects, but are
> different objects with the same attributes (answer (d) above). Also
> show us the code for retrieving the comments later; possibly you are
> retrieving the same element of the comments list each time. Use this:
> print [id(x) for x in comments]
> to verify your assertion that they are all the same object.
>
> Cheers,
> John

aye yaye aye...  thanks for the pointers in the right direction..  i
fiddled around with the code for a while and now i've reduced it to the
*real* issue...  i have a class dict variable that apparently holds its
value across instantiations of new objects..  the problem can be
illustrated in the following much simpler code:

>>> class foo():
... bar = { 'baz': 'bing' }
...
>>> a = foo()
>>> a.bar
{'baz': 'bing'}
>>> a.bar['baz'] = 'bong'
>>> a.bar
{'baz': 'bong'}
>>> b = foo()
>>> b.bar
{'baz': 'bong'}


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Interfaces to high-volume discussion forums

2007-12-01 Thread Paul Rubin
Michael Spencer <[EMAIL PROTECTED]> writes:
> I agree:  I use Thunderbird, and it works well.  But I read NNTP
> newsgroups on several devices, and I would really like to have the
> read-status synchronized across them.
> Can anyone recommend a solution that also synchronizes post read
> status?

I think there are some nntp-imap gateways.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Interfaces to high-volume discussion forums

2007-12-01 Thread Michael Spencer
Dennis Lee Bieber wrote:
> On Fri, 30 Nov 2007 11:36:44 -0800, Michael Spencer
>>
>> Can anyone recommend a solution that also synchronizes post read status?  If 
>> Google Reader or something like it handled NNTP, I imagine I'd use it to 
>> achieve 
>> this benefit.
>>
>   Unlike email clients (SMTP/POP) which physically delete messages
> from the server, NNTP clients just work from a local list of available
> newsgroups -- including a flag for subscription status, and a list of
> message numbers that have been read. The only way to synchronize news
> readers would be to somehow share this list among them.
> 
Yep, that's what I'm looking for.  Either a client that synchronizes message 
status (like a bookmark synchronizer, such as Foxmarks for Firefox), or a 
threaded web-based newsreader that preserves state (as Google Reader does for 
RSS feeds).

Michael


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pickling dictionaries containing dictionaries: failing, recursion-style!

2007-12-01 Thread John Machin
On Dec 2, 9:49 am, Paul Rubin  wrote:
> John Machin <[EMAIL PROTECTED]> writes:
> > self.words is obviously an iterable (can you see "for word in
> > self.words" in his code?), probably just a list.
>
> It could be a file, in which case its iterator method would read lines
> from the file and cause that error message.

Impossible:
(1) in "for word in words:" each word would end in "\n" and he'd have
to strip those and there's no evidence of that.
(2) Look at the line """afterwords =  [self.words[i + 1] for i, e in
enumerate(self.words) if e == word]"""
and tell me how that works if self.words is a file!
(3) "self.words.count(word)" -- AttributeError: 'file' object has no
attribute 'count'


> But I think the answer is
> that the pickle itself needs to be opened in binary mode, as someone
> else posted.

The answer is (1) he needs to supply a file of any kind for a start
[read the error messages that he got!!]
(2) despite the silence of the docs, it is necessary to have opened
the file in binary mode on systems where it makes a difference
(notably Windows)

[If the OP is still reading this thread, here's an example of how to
show a problem, with minimal code that reproduces the problem, and all
the output including the stack trace]

C:\junk>type dpkl.py
import pickle

d = {'and': [1, {'to': 1}], 'down': [1, {'upon': 1}], 'them': [1,
{'down':
1}], 'no': [1, {'others': 1}], 'this': [1, {'it': 1}], 'is': [2, {'a':
2}], 'upon': [1, {'a': 1}], 'it': [2, {'is': 2}], 'think': [2, {'and':
1, 'words': 1}], 'write': [1, {'this': 1}], 'to': [3, {'write': 1,
'put': 1, 'think': 1}], 'words': [1, {'no': 1}], 'others': [1,
{'think': 1}], 'put': [1, {'them': 1}], 'sin': [2, {'to': 2}]}

s = pickle.dumps(d, -1)
dnews = pickle.loads(s)
print "string", dnews == d

out = open("mchain.pkl",'wb')
pickle.dump(d, out, -1)
out.close()

f = open("mchain.pkl", "rb")
dnewb = pickle.load(f)
f.close()
print "load binary", dnewb == d

f = open("mchain.pkl", "r")
dnewa = pickle.load(f)
f.close()
print "load text", dnewa == d

C:\junk>python dpkl.py
string True
load binary True
Traceback (most recent call last):
  File "dpkl.py", line 24, in 
dnewa = pickle.load(f)
  File "c:\python25\lib\pickle.py", line 1370, in load
return Unpickler(file).load()
  File "c:\python25\lib\pickle.py", line 858, in load
dispatch[key](self)
  File "c:\python25\lib\pickle.py", line 1169, in load_binput
i = ord(self.read(1))
TypeError: ord() expected a character, but string of length 0 found

Changing the first line to
import cPickle as pickle
gives this:

C:\junk>python dpkl.py
string True
load binary True
Traceback (most recent call last):
  File "dpkl.py", line 24, in 
dnewa = pickle.load(f)
EOFError

Each of the two different errors indicate that reading was terminated
prematurely by the presence of the good ol' ^Z aka CPMEOF in the file:

>>> s = open('mchain.pkl', 'rb').read()
>>> s.find(chr(26))
179
>>> len(s)
363

HTH,
John
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Tóth Csaba
Russ P. írta:
>>> Newton was a great scientist, and his name is easy to spell and
>>> pronounce.
>> Should be, but a large proportion of the population pronounce it so
>> that it rhymes with "hootin" as in "hootin n hollerin" :-)
> 
> You can count me in that large proportion. 8^)
> 
> The 1 also serves to identify the major version. If it ever undergoes
> a major revision (as in Python3000), it could then be called Newton2,
> but that would not be done more than once per decade or so.

Lets evaluate from the Python3000: Newton3 (N3).

+1 vote from me :)

tsabi
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Russ P.

> > Newton was a great scientist, and his name is easy to spell and
> > pronounce.
>
> Should be, but a large proportion of the population pronounce it so
> that it rhymes with "hootin" as in "hootin n hollerin" :-)

You can count me in that large proportion. 8^)

By the way, after thinking about it a bit, here's a good name for
Python3000:

Newton1

The appended 1 serves to disambiguate the name from that of a late,
great scientist. It could be called N1 for short.

The 1 also serves to identify the major version. If it ever undergoes
a major revision (as in Python3000), it could then be called Newton2,
but that would not be done more than once per decade or so.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pickling dictionaries containing dictionaries: failing, recursion-style!

2007-12-01 Thread John Machin
On Dec 2, 8:59 am, lysdexia <[EMAIL PROTECTED]> wrote:
> I'm having great fun playing with Markov chains. I am making a
> dictionary of all the words in a given  string, getting a count of how
> many appearances word1 makes in the string, getting a list of all the
> word2s that follow each appearance of  word1 and a count of how many
> times word2 appears in the string as well. (I know I should probably
> be only counting how many times word2 actually follows word1, but as I
> said, I'm having great fun playing ...)
>
> printed output of the dictionary looks like so:
>
> {'and': [1, {'to': 1}], 'down': [1, {'upon': 1}], 'them': [1, {'down':
> 1}], 'no': [1, {'others': 1}], 'this': [1, {'it': 1}], 'is': [2, {'a':
> 2}], 'upon': [1, {'a': 1}], 'it': [2, {'is': 2}], 'think': [2, {'and':
> 1, 'words': 1}], 'write': [1, {'this': 1}], 'to': [3, {'write': 1,
> 'put': 1, 'think': 1}], 'words': [1, {'no': 1}], 'others': [1,
> {'think': 1}], 'put': [1, {'them': 1}], 'sin': [2, {'to': 2}]}
>
> Here's the actual function.
>
> def assembleVocab(self):
>   self.wordDB = {}
>   for word in self.words:
> try:
>   if not word in self.wordDB.keys():
> wordsWeights = {}
> afterwords =  [self.words[i + 1] for i, e in
> enumerate(self.words) if e == word]
> for aw in afterwords:
>   if not aw in wordsWeights.keys():
> wordsWeights[aw] = afterwords.count(aw)
> self.wordDB[word] = [self.words.count(word), wordsWeights]
> except:
>   pass
>   out = open("mchain.pkl",'wb')
>   pickle.dump(self.wordDB, out, -1)
>   out.close()
>
> My problem is, I can't seem to get it to unpickle. When I attempt to
> load the
> saved data, I get:
>
> AttributeError: 'tuple' object has no attribute 'readline'
>
> with pickle, and
>
> TypeError: argument must have 'read' and 'readline' attributes

The code that created the dictionary is interesting, but not very
relevant. Please consider posting the code that is actually giving the
error!
>
> Looking at the pickle pages on docs.python.org, I see that I am
> indeed
> supposed to be able to pickle ``tuples, lists, sets, and dictionaries
> containing only picklable objects''.
>
> I'm sure I'm missing something obvious.  Clues?

The docs for pickle.load(file) say """
Read a string from the open file object file and interpret it as a
pickle data stream, reconstructing and returning the original object
hierarchy. This is equivalent to Unpickler(file).load().

file must have two methods, a read() method that takes an integer
argument, and a readline() method that requires no arguments. Both
methods should return a string. Thus file can be a file object opened
for reading, a StringIO object, or any other custom object that meets
this interface.
"""

The error message(s) [plural??] that you are getting suggest(s) that
the argument that you supplied was *not* an open file object nor
anything else with both a read and readline method. Open the file in
binary mode ('rb') and pass the result to pickle.load.
-- 
http://mail.python.org/mailman/listinfo/python-list


using pdb and catching exception

2007-12-01 Thread Amit Gupta
Py'ites

I am using pdb to check my code, and I would like to put a statement
like equivalent of "C++gdb>catch throw".

Basically, I would like debugger to start as soon as an exception is
thrown. How may I do it?


Thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pickling dictionaries containing dictionaries: failing, recursion-style!

2007-12-01 Thread Paul Rubin
John Machin <[EMAIL PROTECTED]> writes:
> self.words is obviously an iterable (can you see "for word in
> self.words" in his code?), probably just a list.

It could be a file, in which case its iterator method would read lines
from the file and cause that error message.  But I think the answer is
that the pickle itself needs to be opened in binary mode, as someone
else posted.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Show this file in explorer"

2007-12-01 Thread MonkeeSage
On Dec 1, 2:58 pm, farsheed <[EMAIL PROTECTED]> wrote:
> But now I have a more technical question. when I run this command, I
> saw that the windows explorer did not refresh,example: I have two
> files in a folder and i use that command to select them from command
> line, the first one will be  selected, but after running the command
> for second file, the second remains unselected. So I need to close the
> explorer and run the command again for the second file. this is
> different from the way iTunes do it.
> Any Idea?
> TIA.
> Farsheed.

I think you want some sort of OLE automation. Perhaps this will
help...

http://farm.tucows.com/blog/_archives/2004/11/23/189572.html

Regards,
Jordan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pickling dictionaries containing dictionaries: failing, recursion-style!

2007-12-01 Thread John Machin
On Dec 2, 9:13 am, Paul Rubin  wrote:
> lysdexia <[EMAIL PROTECTED]> writes:
> > self.wordDB[word] = [self.words.count(word), wordsWeights]
>
> what is self.words.count?  Could it be an iterator?  I don't think you
> can pickle those.

Wht??
self.words is obviously an iterable (can you see "for word in
self.words" in his code?), probably just a list.
self.words.count looks like a standard sequence method to me.
self.words.count(word) will return an int -- can you see all those
"[1,", "[2," etc in his printed dict output?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread John Machin
On Dec 2, 8:40 am, "Russ P." <[EMAIL PROTECTED]> wrote:
>
> None. None of them are good names by my criteria. But then, a name is
> only a name. One of the few names I like is Pascal, because he was a
> great mathematician and scientist.
>
> After thinking about it a bit, here are examples of what I would
> consider a good name for a programming language:
>
> Newton#
> Newton*
> Newton+
>
> Newton was a great scientist, and his name is easy to spell and
> pronounce.

Should be, but a large proportion of the population pronounce it so
that it rhymes with "hootin" as in "hootin n hollerin" :-)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Paul Rudin
"J. Clifford Dyer" <[EMAIL PROTECTED]> writes:


> ...Perl is named for a knitting technique, Lisp is named for a
> speech impediment...

I can't figure out whether you're being serious or not but, for the
record, those are not where the names of those two languages come
from.

http://en.wikipedia.org/wiki/Perl#Name
http://en.wikipedia.org/wiki/Lisp_programming_language
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pickling dictionaries containing dictionaries: failing, recursion-style!

2007-12-01 Thread David Tweet
Are you opening the file in binary mode ("rb") before doing pickle.load on it?

On 01 Dec 2007 14:13:33 -0800, Paul Rubin
<"http://phr.cx"@nospam.invalid> wrote:
> lysdexia <[EMAIL PROTECTED]> writes:
> > self.wordDB[word] = [self.words.count(word), wordsWeights]
>
> what is self.words.count?  Could it be an iterator?  I don't think you
> can pickle those.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
-David
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to read strings cantaining escape character from a file and use it as escape sequences?

2007-12-01 Thread John Machin
On Dec 2, 2:33 am, Duncan Booth <[EMAIL PROTECTED]> wrote:
> slomo <[EMAIL PROTECTED]> wrote:
>  print line
> > \u0050\u0079\u0074\u0068\u006f\u006e
>
> > But I want to get a string:
>
> > "\u0050\u0079\u0074\u0068\u006f\u006e"
>
> > How do you make it?
>
> line.decode('unicode-escape')

Amazing what you can find in obscure corners of the obscure docs! BTW,
how many folks know what "bijective" means ?

Hmmm ... the encode is documented as "Produce a string that is
suitable as Unicode literal in Python source code", but it *isn't*
suitable. A Unicode literal is u'blah', this gives just blah. Worse,
it leaves the caller to nut out how to escape apostrophes and quotes:

>>> test = u'Python\'\'\'\'\"\"\"\"\u1234\n'
>>> print repr(test)
u'Python\'\'\'\'\u1234\n'
>>> print test.encode('unicode-escape')
Python\u1234\n
>>>

Why would someone bother writing this codec when repr() does the job
properly?

Anyhow, here's a solution to the OP's stated problem from first
principles using basic building blocks:

>>> line = '\\u0050\\u0079\\u0074\\u0068\\u006f\\u006e\n'
>>> u''.join(unichr(int(x, 16)) for x in line.split(r'\u') if x and x != '\n') 
>>> + u'\n'
u'Python\n'
>>>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pickling dictionaries containing dictionaries: failing, recursion-style!

2007-12-01 Thread Paul Rubin
lysdexia <[EMAIL PROTECTED]> writes:
> self.wordDB[word] = [self.words.count(word), wordsWeights]

what is self.words.count?  Could it be an iterator?  I don't think you
can pickle those.
-- 
http://mail.python.org/mailman/listinfo/python-list


Pickling dictionaries containing dictionaries: failing, recursion-style!

2007-12-01 Thread lysdexia
I'm having great fun playing with Markov chains. I am making a
dictionary of all the words in a given  string, getting a count of how
many appearances word1 makes in the string, getting a list of all the
word2s that follow each appearance of  word1 and a count of how many
times word2 appears in the string as well. (I know I should probably
be only counting how many times word2 actually follows word1, but as I
said, I'm having great fun playing ...)


printed output of the dictionary looks like so:

{'and': [1, {'to': 1}], 'down': [1, {'upon': 1}], 'them': [1, {'down':
1}], 'no': [1, {'others': 1}], 'this': [1, {'it': 1}], 'is': [2, {'a':
2}], 'upon': [1, {'a': 1}], 'it': [2, {'is': 2}], 'think': [2, {'and':
1, 'words': 1}], 'write': [1, {'this': 1}], 'to': [3, {'write': 1,
'put': 1, 'think': 1}], 'words': [1, {'no': 1}], 'others': [1,
{'think': 1}], 'put': [1, {'them': 1}], 'sin': [2, {'to': 2}]}

Here's the actual function.

def assembleVocab(self):
  self.wordDB = {}
  for word in self.words:
try:
  if not word in self.wordDB.keys():
wordsWeights = {}
afterwords =  [self.words[i + 1] for i, e in
enumerate(self.words) if e == word]
for aw in afterwords:
  if not aw in wordsWeights.keys():
wordsWeights[aw] = afterwords.count(aw)
self.wordDB[word] = [self.words.count(word), wordsWeights]
except:
  pass
  out = open("mchain.pkl",'wb')
  pickle.dump(self.wordDB, out, -1)
  out.close()

My problem is, I can't seem to get it to unpickle. When I attempt to
load the
saved data, I get:

AttributeError: 'tuple' object has no attribute 'readline'

with pickle, and

TypeError: argument must have 'read' and 'readline' attributes

Looking at the pickle pages on docs.python.org, I see that I am
indeed
supposed to be able to pickle ``tuples, lists, sets, and dictionaries
containing only picklable objects''.

I'm sure I'm missing something obvious.  Clues?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: os.access() under windows

2007-12-01 Thread David Tweet
To answer indirectly, usually the EAFP (easier to ask forgiveness than
permission) approach works better for this kind of thing.

try:
  f = open('e:\\test\\test', 'a')
  f.write('abc')
  f.close()
except IOError:
  print "couldn't write test file, continuing..."

On Dec 1, 2007 1:48 AM, Yann Leboulanger <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Under Windows XP os.access has a strange behaviour:
>
> I create a folder test under e:
>
> then os.access('e:\\test', os.W_OK) returns True. Everything's ok.
>
> Now I move My Documents to this e:\test folder
>
> Then os.access('e:\\test', os.W_OK) returns False !!
>
> but this works:
> f = open('e:\\test\\test', 'a')
> f.write('abc')
> f.close()
>
> So why os.access returns False ?
>
> --
> Yann
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
-David
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Russ P.
On Dec 1, 12:47 pm, "J. Clifford Dyer" <[EMAIL PROTECTED]> wrote:
> On Sat, 2007-12-01 at 12:10 -0800, Russ P. wrote:
> > On Dec 1, 2:10 am, Bjoern Schliessmann  > [EMAIL PROTECTED]> wrote:
> > > Russ P. wrote:
> > > > I agree that Python is not a good name for a programming language,
>
> > > Why not?
>
> > Think about proposing its use to someone who has never heard of it
> > (which I did not too long ago). As the OP pointed out, a Python is a
> > snake. Why should a programming language be named after a snake?
>
> That's not a persuasive argument.
>
> First of all, Python is named for a comedy troupe from England.  For
> comparison, Perl is named for a knitting technique, Lisp is named for a
> speech impediment, Ruby is named for a rock, Smalltalk is named for a
> not-so-useful form of communication, and Java is named after a beverage
> or an island.
>
> Which of those is a good name for a programming language by your
> criterion?

None. None of them are good names by my criteria. But then, a name is
only a name. One of the few names I like is Pascal, because he was a
great mathematician and scientist.

After thinking about it a bit, here are examples of what I would
consider a good name for a programming language:

Newton#
Newton*
Newton+

Newton was a great scientist, and his name is easy to spell and
pronounce. The trailing character serves to disambiguate it from
Newton in online searches. For shorthand in online discussions, N#,
N*, or N+ could be used as aliases.

Names of other great scientists, mathematicians, or computer
scientists could also be used, of course. Take your pick.

How about renaming Python3000?
-- 
http://mail.python.org/mailman/listinfo/python-list


build boost.python tutorial "hello world" without bjam

2007-12-01 Thread devito
hi there,

for some days i try to build the boost.python tutorial "hello world"
without bjam on winxp by using mingw.
so i wrote a *.bat-file like the following:

// --- snip
--
@echo off
SETLOCAL
SET DIR_MINGW=c:\development_compiler\mingw\
SET DIR_BOOST=c:\development_compiler\_boost\
SET DIR_PYTHN=c:\development_compiler\python25\
SET DIR_PRJCT=%~dp0
SET NME_PRJCT=hello
SET CC=c:\development_compiler\mingw\bin\g++.exe
SET INCL=-I%DIR_BOOST%include\boost-1_34_1 -I%DIR_PYTHN%include -I
%DIR_MINGW%include
SET LIBS=-L%DIR_BOOST%lib -L%DIR_PYTHN%libs -L%DIR_MINGW%lib
%CC% -O0 -shared %INCL% %LIBS% -lboost_python-mgw34-s-1_34_1 -
lpython25 %DIR_PRJCT%%NME_PRJCT%.cpp -o %NME_PRJCT%.pyd
ENDLOCAL
// --- snip
--

this works fine. but nevertheless it produces errors.

// --- snip
--
D:\Temp\boost_test>c:\development_compiler\mingw\bin\g++.exe -O0 -
shared -Ic:\de
velopment_compiler\_boost\include\boost-1_34_1 -Ic:
\development_compiler\python2
5\include -Ic:\development_compiler\mingw\include -Lc:
\development_compiler\_boo
st\lib -Lc:\development_compiler\python25\libs -Lc:
\development_compiler\mingw\l
ib -lboost_python-mgw34-mt-s-1_34_1 -lpython25 D:\Temp\boost_test
\hello.cpp -o h
ello.pyd
C:\DOKUME~1\DBlock\LOKALE~1\Temp/cciAbaaa.o:hello.cpp:(.text+0x11e):
undefined r
eference to `_imp___ZN5boost6python6detail11init_moduleEPKcPFvvE'
C:\DOKUME~1\DBlock\LOKALE~1\Temp/cciAbaaa.o:hello.cpp:(.text
$_ZN5boost6python3de
fIPFPKcvEEEvS3_T_[void boost::python::def(char
const*, char c
onst* (*)())]+0x6e): undefined reference to
`_imp___ZN5boost6python6detail17scop
e_setattr_docEPKcRKNS0_3api6objectES3_'
C:\DOKUME~1\DBlock\LOKALE~1\Temp/cciAbaaa.o:hello.cpp:(.text
$_ZN5boost6python6de
tail17make_function_auxIPFPKcvENS0_21default_call_policiesENS_3mpl7vector1IS4_EE
EENS0_3api6objectET_RKT0_RKT1_[boost::python::api::object
boost::python::detail:
:make_function_aux >(char const* (*)(),
boost::python::default_call_po
licies const&, boost::mpl::vector1 const&)]+0x73):
undefined refere
nce to
`_imp___ZN5boost6python7objects15function_objectERKNS1_11py_functionE'
C:\DOKUME~1\DBlock\LOKALE~1\Temp/cciAbaaa.o:hello.cpp:(.text
$_ZN5boost6python7ob
jects21py_function_impl_baseC2Ev[boost::python::objects::py_function_impl_base::
py_function_impl_base()]+0x7): undefined reference to
`_imp___ZTVN5boost6python7
objects21py_function_impl_baseE'
C:\DOKUME~1\DBlock\LOKALE~1\Temp/cciAbaaa.o:hello.cpp:(.rdata
$_ZTVN5boost6python
7objects23caller_py_function_implINS0_6detail6callerIPFPKcvENS0_21default_call_p
oliciesENS_3mpl7vector1IS6_EE[vtable for
boost::python::objects::caller_py_f
unction_impl > >]+0x18):
undefined refer
ence to `boost::python::objects::py_function_impl_base::max_arity()
const'
C:\DOKUME~1\DBlock\LOKALE~1\Temp/cciAbaaa.o:hello.cpp:(.text
$_ZN5boost6python3ap
i6objectC2Ev[boost::python::api::object::object()]+0x7): undefined
reference to
`_imp___Py_NoneStruct'
C:\DOKUME~1\DBlock\LOKALE~1\Temp/cciAbaaa.o:hello.cpp:(.text
$_ZN5boost6python7ob
jects23caller_py_function_implINS0_6detail6callerIPFPKcvENS0_21default_call_poli
ciesENS_3mpl7vector1IS6_ED1Ev[boost::python::objects::caller_py_function_imp
l >
>::~caller_py_function_impl()]+0x16)
: undefined reference to
`_imp___ZN5boost6python7objects21py_function_impl_baseD
2Ev'
C:\DOKUME~1\DBlock\LOKALE~1\Temp/cciAbaaa.o:hello.cpp:(.text
$_ZN5boost6python7ob
jects23caller_py_function_implINS0_6detail6callerIPFPKcvENS0_21default_call_poli
ciesENS_3mpl7vector1IS6_ED0Ev[boost::python::objects::caller_py_function_imp
l >
>::~caller_py_function_impl()]+0x16)
: undefined reference to
`_imp___ZN5boost6python7objects21py_function_impl_baseD
2Ev'
C:\DOKUME~1\DBlock\LOKALE~1\Temp/cciAbaaa.o:hello.cpp:(.text
$_ZNK5boost6python15
to_python_valueIRKPKcEclES5_[boost::python::to_python_value:
:operator()(char const* const&) const]+0xf): undefined reference to
`_imp___ZN5b
oost6python9converter19do_return_to_pythonEPKc'
C:\DOKUME~1\DBlock\LOKALE~1\Temp/cciAbaaa.o:hello.cpp:(.text
$_ZNK5boost6python9t
ype_info4nameEv[boost::python::type_info::name() const]+0x15):
undefined referen
ce to `_imp___ZN5boost6python6detail12gcc_demangleEPKc'
collect2: ld returned 1 exit status
// --- snip
--

any ideas what's wrong? any ideas how to fix that?

many, many thnx
daniel
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Sorting array

2007-12-01 Thread Robert Kern
Tartifola wrote:
> 
> Hi,
> 
> On Fri, 30 Nov 2007 14:55:08 -0600
> Robert Kern <[EMAIL PROTECTED]> wrote:

>> numpy questions are best asked on the numpy-discussion mailing list since
>> everyone there automatically knows that you are talking about numpy arrays 
>> and
>> not just misnaming lists.  ;-)
>>
>>   http://www.scipy.org/Mailing_Lists
> 
> thanks a lot for your help and sorry for using the wrong list.

No need to apologize. This isn't the wrong list; it's just that there is a
better list.  :-)

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Show this file in explorer"

2007-12-01 Thread farsheed
But now I have a more technical question. when I run this command, I
saw that the windows explorer did not refresh,example: I have two
files in a folder and i use that command to select them from command
line, the first one will be  selected, but after running the command
for second file, the second remains unselected. So I need to close the
explorer and run the command again for the second file. this is
different from the way iTunes do it.
Any Idea?
TIA.
Farsheed.
-- 
http://mail.python.org/mailman/listinfo/python-list


LIVE TEEN CAM in my ROOM!

2007-12-01 Thread Mberyl1




   
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread J. Clifford Dyer

On Sat, 2007-12-01 at 12:10 -0800, Russ P. wrote:
> On Dec 1, 2:10 am, Bjoern Schliessmann  [EMAIL PROTECTED]> wrote:
> > Russ P. wrote:
> > > I agree that Python is not a good name for a programming language,
> >
> > Why not?
> 
> Think about proposing its use to someone who has never heard of it
> (which I did not too long ago). As the OP pointed out, a Python is a
> snake. Why should a programming language be named after a snake?

That's not a persuasive argument.

First of all, Python is named for a comedy troupe from England.  For
comparison, Perl is named for a knitting technique, Lisp is named for a
speech impediment, Ruby is named for a rock, Smalltalk is named for a
not-so-useful form of communication, and Java is named after a beverage
or an island.  

Which of those is a good name for a programming language by your
criterion?  I like the name Python.  It has a nice ring to it, and has
connotations that are simultaneously badass and humorous.  

For that matter, why name sneakers after a goddess of justice?  Why name
a car after a planet/resort town/rodent/mountain?

Because brand names are supposed to be memorable, not meaningful.

Cheers,
Cliff



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: (More) Re: Is __import__ known to be slow in windows?

2007-12-01 Thread Joshua Kugler
John Machin wrote:

> On Dec 1, 2:12 pm, Joshua Kugler <[EMAIL PROTECTED]> wrote:
>> x = __import__(m)
> 
> Have you ever tried print m, x.__file__ here to check that the modules
> are being found where you expect them to be found?

No, I haven't, but I do know for a fact that the only location of the module
found is where I think it is.  There are no other modules on the system (or
in the search path) named _modulename.

>> except ImportError, e:
>> if not e.message.startswith('No module named'):
>> raise
> 
> Why are you blindly ignoring the possibly that the module is not
> found? Note that loading a module after it is found is not a zero-cost
> operation.

That was in the original code to silently ignore things like a README file
or a directory that didn't have a __init__.py file.  The code I posted was
from my benchmarking script.  The code in the framework does a listdir()
and goes through that list trying to import.  We'll probably "smarten up"
that code a bit, but for now it works.

>> x = None
>>
>> Each of those three module names is a directory under /path/to/code with
>> an empty __init_.py.
> Is there anything else in the /path/to/code directory?

A directory and a file that aren't referenced in my test, but are
in the framework's import attempts (see listdir() comment above). 
Regardless, setting sys.path to just one directory speeds up both the
benchmark and the framework.

>> def r():
>> for m in ['three','module','names']:
>> x = __import__(m)
> 
> Have you tried print m, x.__file__ here to check that the modules are
> being found where you expect them to be found?

As I said above, no I haven't, but I will just to double check.

On Linux, print x, x.__name__ produces the expected result whether I have
one element in sys.path or all of them. On Windows, same result.

> Call me crazy, but: First experiment, sys.path was ['/path/to/code',
> '', etc etc]. Now it's only ['/path/to/code']. How can that still load
> properly but run faster??

I don't know, but it does.  Right now, we're just importing empty modules. 
Once those modules have imports of their own, my "fix" will probably fall
apart, and we'll be back to square one.

> What directory tree walking?? Should be none 
> if the modules are found in /path/to/code.

I know, that's the crazy thing...there should be no directory tree walking
or other filesystem activity after finding the module.  But setting
sys.path to one element does make a difference; that can be seen.  I don't
know the internal implementation of __import__, so I can't really comment
beyond my results.  Maybe I need to strace a python run.

> Are you sure the modules 
> are always found in /path/to/code? What is in the current directory
> [matched by '' in sys.path]?

'' would be whereever I start the benchmark script (~/bin), or whereever the
framework is started from, probably from the web server's home directory,
or from ~/bin when I'm profiling the framework.

Thanks for your responses.  I still trying to figure this out too. :)

j

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Neil Cerutti
On 2007-12-01, Bjoern Schliessmann <[EMAIL PROTECTED]> wrote:
> Dotan Cohen wrote:
>> C was named after the B programming language, as it was inspired
>> and meant to replace it. C++ is obviously C+1
>
> Strictly speaking, C++ evalutes to C, but C is incremented
> afterwards.

Bjarne was only interested in the side-effect. Anyhow,
Pythonistas know it should've been called "C+=1".

-- 
Neil Cerutti
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Russ P.
On Dec 1, 2:10 am, Bjoern Schliessmann  wrote:
> Russ P. wrote:
> > I agree that Python is not a good name for a programming language,
>
> Why not?

Think about proposing its use to someone who has never heard of it
(which I did not too long ago). As the OP pointed out, a Python is a
snake. Why should a programming language be named after a snake?

> BTW, is "Windows" a great name for an operating system?

No.

> > Speaking of stupid names, what does "C++" mean?
>
> It's "C incremented".

I know that. But "C" was already a dumb name, and "C++" compounded the
dumbness. Actually, "C" was probably intended as a temporary name for
internal use, but not for a widely used, standard language.

> > I think it's the grade you get when you just barely missed
> > a "B--".
>
> So what dou you think about D language? :) Or F or F#?

I think that one-letter names are even worse for languages than they
are for variables.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Dotan Cohen
On 01/12/2007, Bjoern Schliessmann
<[EMAIL PROTECTED]> wrote:
> Strictly speaking, C++ evalutes to C, but C is incremented
> afterwards.
>

:) I will remember that!

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: C/C++ on UNIX Developer required in Woodmead, Johannesburg

2007-12-01 Thread J. Clifford Dyer
Please don't.  This job is not even vaguely python related.


On Sat, 2007-12-01 at 18:42 +0100, James Matthews wrote:
> Please post in the Python Wiki under the jobs
> 
> On Dec 1, 2007 9:38 AM, arnold <[EMAIL PROTECTED]> wrote:
> We seek the following sort of experience / skill for developer
> resources (if u do not qualify - we offer a handsome referral
> fee if
> you refer someone that is succesfully placed:-) .
> 
> C Programming  5 years
> C++ Programming  2 years
> SQL Programming  2 years
> Software Design  2 years
> Software Engineering Process  3 years
> GUI Development 1 year
> Unix/Linux environment 2 years
> Scientific/Mathematical Programming  2 years 
> 
> 
> These skills all need to be current.
> 
> 
> The candidate should demonstrate an ability to work
> resourcefully and
> independently, whilst delivering in the framework of a team.
>  The
> candidate must also demonstrate a willingness and desire to
> program 
> hands-on in C and C++ code.  He/she must have personally
> developed
> significant amounts of program code, demonstrating and
> requiring
> modular design and the use of a source code repository for
> version
> control.
> 
> 
> The candidate must communicate well, and be comfortable
> discussing
> design issues with both the team and the customer.  His / her
> present
> role should require this of him/her.
> 
> 
> The candidate must be able to describe the software
> development 
> lifecycle and identify his/her personal points of interaction
> in that
> cycle. These points must be Functional Requirements
> Specification,
> Software Design, Programming and Unit Testing.
> 
> 
> The following skills would be an advantage: 
>   Object oriented design
>   UML and the use of design tools like Rational Rose
>   Development tools (GDB, DBX, WxWidets/Qt/GTK,
> Makefiles
> etc.)
> 
> 
> --
> http://mail.python.org/mailman/listinfo/python-list
> 
> 
> 
> -- 
> http://search.goldwatches.com/?Search=Movado+Watches 
> http://www.jewelerslounge.com
> http://www.goldwatches.com 
> -- 
> http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Check if a symlink is broken or circular

2007-12-01 Thread [EMAIL PROTECTED]
Giampaolo Rodola' wrote:
> On 1 Dic, 00:10, "Martin v. L�wis" <[EMAIL PROTECTED]> wrote:
> > > I would like to know if such function would be correct for verifying
> > > if a link is broken and/or circular.
> >
> > > def isvalidlink(path):
> > > assert os.path.islink(path)
> > > try:
> > > os.stat(path)
> > > except os.error:
> > > return 1
> > > return 0
> >
> > You meant to flip the result values, right? 1 should mean that the
> > link is value, and 0 that it is not.
> >
> > Mostly. If the link is correct, but you don't have permission to stat
> > the target file, you get 0. OTOH, in that case, you have no way of
> > finding out whether the link *is* correct.
> >
> > Still, you could try to detect the errnos that indicate a problem
> > with the link itself, and pass all other errors through.
> >
> > Regards,
> > Martin
>
> Mmmm... do you mean something like this?
> Could it be ok?
>
>

I think he meant something like this (see below):

>
> import os, errno
>
> def isvalidlink(path):
> assert os.path.lexists(path)
> try:
> os.stat(path)
> except os.error, err:
> # broken link
> # "No such file or directory"
> if err.errno == errno.ENOENT:
> return 1

Right, except that it should be return 0 (or preferably return False)
unless you want inverted logic.

> # circular link
> # "Too many levels of symlinks"
> elif err.errno == errno.ELOOP:
> return 2

Change to return 1/True (inverted) or return 0/False (not inverted)

> # something else occurred,
> # assume it as invalid anyway
> else:
> return 3

Change "return 3" to "raise", so the exception gets propagated.

> return 0

Again, if you do not want the logic to be inverted, use return 1/True
instead

--Nathan Davis
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Dan Upton
On Dec 1, 2007 12:34 PM, Bjoern Schliessmann
<[EMAIL PROTECTED]> wrote:
> Dotan Cohen wrote:
> > C was named after the B programming language, as it was inspired
> > and meant to replace it. C++ is obviously C+1
>
> Strictly speaking, C++ evalutes to C, but C is incremented
> afterwards.
>

I guess plus-plus-C just doesn't roll off the tongue as well...
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Error: UnboundLocalError: local variable 'PfFlag' referenced before assignment

2007-12-01 Thread [EMAIL PROTECTED]
Calvin wrote:
> On Nov 30, 3:07 pm, "Wang, Harry" <[EMAIL PROTECTED]> wrote:
> > $$ TestCase ID : 001
> > Step : deleteDvc,206268
> > Result Eval type : XmlChk
> > Step : deleteDvc,206269
> > Result Eval type : XmlChk
> > Traceback (most recent call last):
> >   File "C:\UDR2\UDRxmlGateway.py", line 388, in 
> > ParseAll()
> >   File "C:\UDR2\UDRxmlGateway.py", line 371, in ParseAll
> > if (PfFlag == 1):
> > UnboundLocalError: local variable 'PfFlag' referenced before assignment
> >
> > PfFlag gets assigned in a for loop in line 365
> > for i in range(PfFlagArrSize):
> > if (PfFlagArr[i] == 1):
> > ---> PfFlag = int(1)
> > break
> > else:
> > PfFlag = int(-1)
> >
> > No idea what is going on here
> >
> > Harry C. Wang
> > Sr. Test Engineer (Automation)
> > Phone 206 - 268 - 7502
> > temporary e-mail: [EMAIL PROTECTED]
> > Personal e-mail: [EMAIL PROTECTED]
> > Ciber EmpID # 36219
>
> OK this problem has been solved.  Duh???  The variable thingy is not
> initialized.

Well, that much is obvious.  What's probably not so obvious is *why*
the "variable thingy" is not initialized.  From what I can tell, this
could only happen if, and only if, PfFlagArrSize <= 0.  In that case,
the body of the for loop will never execute and PfFlag will *not* be
set, hence the error.

--Nathan Davis
-- 
http://mail.python.org/mailman/listinfo/python-list


Trusted GPT Sites& business idea

2007-12-01 Thread midomssh
how to earn money different tips & tricks
to read more
http://bigfatcash.blogspot.com
-- 
http://mail.python.org/mailman/listinfo/python-list


CoCoPy Beta released

2007-12-01 Thread Ron Provost
I would like to introduce CoCo/r to the Python world.  CoCo/r is an scanner 
generator and LL(k) parser generator which has already been ported to many 
languages.  CocoPy 1.0.3b1 can be found in the Python Package Index.

Features:
- The generated scanner and parser are completely independant.  Either is 
easily replaced by handwritten equivalents.

- The syntax for the target language specification is reminicent of the Pascal 
family of languages.

- The production syntax is not the usual UNIX regular expression syntax.  
Instead, CoCo uses the much more readable EBNF syntax introduced by Nicholas 
Wirth.  This same syntax is used for writing productions for both the regular 
(token syntax) and context free (phrase or statement syntax) grammars.

- The specification language supports botn inherited and synthetic attributes; 
as well as embedding semantic actions throughout a production.

- The generated scanners are DFAs.

- The generated parsers are recursive descent (hence the /r in CoCo/r)

- Features like comments and case (in)sensativity are handled automatically.

- Lexemes may be context dependant.

- CoCo provides a unique and easy to use error recovery system; a difficult 
problem in recursive descent parsers.

- The developer can customize error messages and event include his own.

What follows is a very simplistic example compiler included in the distribution.

# === Calc.atg

COMPILER Calc

   # ---
   # Everything here goes into the parser class

   VARS = [ 0 for x in xrange( 0, 1000 ) ]   # Create an array to hold the 
variables

   def getSpix( self ):
  varName = self.token.val.upper()   # Grab the most recently parsed lexeme

  if len(varName) >= 2:
 return 26*(ord(varName[1])-ord('A'))+(ord(varName[0])-ord('A'))
  else:
 return ord(varName[0])-ord('A')

   def getNumber( self ):
  return int(self.token.val)

   def newVar( self, spix ):
  self.VARS[ spix ] = 0

   def getVar( self, spix ):
  return self.VARS[ spix ]

   def writeVal( self, val ):
  print val

   def readVal( self, spix ):
  self.VARS[ spix ] = int(raw_input( 'Read >' ))

   def setVar( self, spix, val ):
  self.VARS[ spix ] = val

   # End of definitions for parser class
   # -

IGNORECASE

CHARACTERS
  letter = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".
  digit  = "0123456789".
  eol= CHR(13) .
  lf = CHR(10) .

TOKENS
  ident  = letter {letter | digit} .
  number = digit {digit} .

COMMENTS
  FROM '--' TO eol

IGNORE eol + lf

PRODUCTIONS
  Calc =
[Declarations] StatSeq .

  Declarations
=
   'VAR'
   Ident(. self.newVar(spix)   .)
   { ',' Ident  (. self.newVar(spix)   .)
   } ';'
.

  StatSeq =
Stat {';' Stat}.

  Stat
=
"READ"  Ident   (. self.readVal(spix)  .)
  | "WRITE" Expr (. self.writeVal(val)  .)
  | Ident ":=" Expr(. self.setVar(spix, val)  .)
.

  Expr
=
  Term
  {  '+' Term(. exprVal += termVal .)
  |  '-' Term(. exprVal -= termVal .)
  }
.

  Term
=
  Fact
  {  '*' Fact(. termVal *= factVal .)
  |  '/' Fact(. termVal /= factVal .)
  }
.

  Fact
=
 Ident  (. factVal = self.getVar(spix) .)
  |  number   (. factVal = self.getNumber()  .)
  | '(' Expr ')'
.

  Ident
= ident   (. spix = self.getSpix()   .)
.

END Calc.


# ---Sample input 
calc.inp

VAR
  A,B,C,D;
  WRITE 1+(2*3)+4;
  WRITE 100/10;
  READ  A;
  WRITE A;
  B := A*16;
  WRITE B*2

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: pythonw.exe and python.exe

2007-12-01 Thread James Matthews
Because they use two different API's to execute your code!

On Nov 30, 2007 9:09 PM, whatazor <[EMAIL PROTECTED]> wrote:

> Hi all,
> I made a little application with multithreading in winxp with
> python2.5. An event generated from a third part software is the
> trigger for the creation of progress bar in a wxPython app. This
> python app is launched via wxExecute.
> I've noticed a different behaviour if the script is launched with
> python.exe  and  pythonw.exe (i.e. without dos shell), in fact in the
> first case it's all ok, while in the other case only the first, the
> third , the fifth  ... progress bar is setted correctly and update its
> value.
> Now, before control again the code , what can be the origin of the
> problem? why python and pythonw give a result so different?
>
> thank you
> w
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
http://search.goldwatches.com/?Search=Movado+Watches
http://www.jewelerslounge.com
http://www.goldwatches.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: C/C++ on UNIX Developer required in Woodmead, Johannesburg

2007-12-01 Thread James Matthews
Please post in the Python Wiki under the jobs

On Dec 1, 2007 9:38 AM, arnold <[EMAIL PROTECTED]> wrote:

> We seek the following sort of experience / skill for developer
> resources (if u do not qualify - we offer a handsome referral fee if
> you refer someone that is succesfully placed:-) .
>
> C Programming  5 years
> C++ Programming  2 years
> SQL Programming  2 years
> Software Design  2 years
> Software Engineering Process  3 years
> GUI Development 1 year
> Unix/Linux environment 2 years
> Scientific/Mathematical Programming  2 years
>
>
> These skills all need to be current.
>
>
> The candidate should demonstrate an ability to work resourcefully and
> independently, whilst delivering in the framework of a team.  The
> candidate must also demonstrate a willingness and desire to program
> hands-on in C and C++ code.  He/she must have personally developed
> significant amounts of program code, demonstrating and requiring
> modular design and the use of a source code repository for version
> control.
>
>
> The candidate must communicate well, and be comfortable discussing
> design issues with both the team and the customer.  His / her present
> role should require this of him/her.
>
>
> The candidate must be able to describe the software development
> lifecycle and identify his/her personal points of interaction in that
> cycle. These points must be Functional Requirements Specification,
> Software Design, Programming and Unit Testing.
>
>
> The following skills would be an advantage:
>   Object oriented design
>   UML and the use of design tools like Rational Rose
>   Development tools (GDB, DBX, WxWidets/Qt/GTK, Makefiles
> etc.)
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
http://search.goldwatches.com/?Search=Movado+Watches
http://www.jewelerslounge.com
http://www.goldwatches.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread James Matthews
Well in the future we will ask the internet god "Google" to guide us in
making the name!

On Dec 1, 2007 6:02 PM, Dotan Cohen <[EMAIL PROTECTED]> wrote:

> On 01/12/2007, Tóth Csaba <[EMAIL PROTECTED]> wrote:
> > man.. :)) the biggest point in this thread :DD
> > btw in my country not much, because we write it "szex" :DD
> >
> > tsabi
> >
>
> We got you beat: "סקס". Try that on a Latin keyboard!
>
> Actually, "szex" might be a great name, as it implies the meaning
> without actually saying it (as far as English speakers are concerned).
> That will be the name of my band if I ever have one...
>
> Dotan Cohen
>
> http://what-is-what.com
> http://gibberish.co.il
> א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
>
> A: Because it messes up the order in which people normally read text.
> Q: Why is top-posting such a bad thing?
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
http://search.goldwatches.com/?Search=Movado+Watches
http://www.jewelerslounge.com
http://www.goldwatches.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: python not a good name.

2007-12-01 Thread James Matthews
Well in the future we will ask the internet god "Google" to guide us in
making the name!

On Dec 1, 2007 7:36 AM, Joseph king <[EMAIL PROTECTED]> wrote:

> sorry for not responding to the thread the regular way...[cough]
>
> just to prove everyone i counted what was found while searching python in
> google.
>
> i only looked at the first 6 pages but out of them only one did not
> mention the language
>
> plus i can't beleive people would be so synical about the issue.  if the
> only reason you use a language is because it has a pretty name.. (you
> would be limited to only ruby)
>
> that is all i can say.
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
http://search.goldwatches.com/?Search=Movado+Watches
http://www.jewelerslounge.com
http://www.goldwatches.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Bjoern Schliessmann
Dotan Cohen wrote:
> C was named after the B programming language, as it was inspired
> and meant to replace it. C++ is obviously C+1

Strictly speaking, C++ evalutes to C, but C is incremented
afterwards.

Regards,


Björn

-- 
BOFH excuse #307:

emissions from GSM-phones

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to read strings cantaining escape character from a file and use it as escape sequences?

2007-12-01 Thread James Matthews
Also alot of times in the interactive interpeter it will show you charater
codes!

On Dec 1, 2007 6:04 PM, slomo <[EMAIL PROTECTED]> wrote:

> WOW! Great! Thanks, Duncan.
>
>
> On 12월2일, 오전12시33분, Duncan Booth <[EMAIL PROTECTED]> wrote:
> > slomo <[EMAIL PROTECTED]> wrote:
> >  print line
> > > \u0050\u0079\u0074\u0068\u006f\u006e
> >
> > > But I want to get a string:
> >
> > > "\u0050\u0079\u0074\u0068\u006f\u006e"
> >
> > > How do you make it?
> >
> > line.decode('unicode-escape')
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
http://search.goldwatches.com/?Search=Movado+Watches
http://www.jewelerslounge.com
http://www.goldwatches.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: How to read strings cantaining escape character from a file and use it as escape sequences?

2007-12-01 Thread slomo
WOW! Great! Thanks, Duncan.


On 12월2일, 오전12시33분, Duncan Booth <[EMAIL PROTECTED]> wrote:
> slomo <[EMAIL PROTECTED]> wrote:
>  print line
> > \u0050\u0079\u0074\u0068\u006f\u006e
>
> > But I want to get a string:
>
> > "\u0050\u0079\u0074\u0068\u006f\u006e"
>
> > How do you make it?
>
> line.decode('unicode-escape')

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Dotan Cohen
On 01/12/2007, Tóth Csaba <[EMAIL PROTECTED]> wrote:
> man.. :)) the biggest point in this thread :DD
> btw in my country not much, because we write it "szex" :DD
>
> tsabi
>

We got you beat: "סקס". Try that on a Latin keyboard!

Actually, "szex" might be a great name, as it implies the meaning
without actually saying it (as far as English speakers are concerned).
That will be the name of my band if I ever have one...

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Dotan Cohen
On 01/12/2007, Russ P. <[EMAIL PROTECTED]> wrote:
> Speaking of stupid names, what does "C++" mean? I think it's the grade
> you get when you just barely missed a "B--". But I can't deny that it
> *is* good for searching.

C was named after the B programming language, as it was inspired and
meant to replace it. C++ is obviously C+1, ie, what comes after C.

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: How to read strings cantaining escape character from a file and use it as escape sequences?

2007-12-01 Thread Duncan Booth
slomo <[EMAIL PROTECTED]> wrote:

 print line
> \u0050\u0079\u0074\u0068\u006f\u006e
> 
> But I want to get a string:
> 
> "\u0050\u0079\u0074\u0068\u006f\u006e"
> 
> How do you make it?
> 

line.decode('unicode-escape')
-- 
http://mail.python.org/mailman/listinfo/python-list


How to read strings cantaining escape character from a file and use it as escape sequences?

2007-12-01 Thread slomo
How to read strings cantaining escape character from a file and use it
as escape sequences?

for example, a file 'unicodes.txt' has contents:

\u0050\u0079\u0074\u0068\u006f\u006e

Now,

>>> file = open('unicodes.txt')
>>> line = file.readline()
>>> line
'\\u0050\\u0079\\u0074\\u0068\\u006f\\u006e\n'
>>> print line
\u0050\u0079\u0074\u0068\u006f\u006e

But I want to get a string:

"\u0050\u0079\u0074\u0068\u006f\u006e"

How do you make it?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Gnu/Linux dialogue boxes in python

2007-12-01 Thread Paul Boddie
On 1 Des, 07:02, Donn Ingle <[EMAIL PROTECTED]> wrote:
> > [1]http://www.python.org/pypi/desktop
>
> Oh, just saw this link and fetched the code -- will have a look around.

The dialogue box support isn't in the released version, but I'll
either upload a new release, or I'll make the code available
separately.

Paul
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Tóth Csaba

Dotan Cohen írta:
> On 01/12/2007, Aaron Watters <[EMAIL PROTECTED]> wrote:
>> On Nov 30, 9:58 am, [EMAIL PROTECTED] wrote:
>>> Now, python3000 is coming. It's the best time to rename!
>> Yes, but "Thong" would be a better name,
>> due to the minimalist syntax and the
>> attraction/repulsion/catatonic revulsion effect it has with
>> different people from different cultural backgrounds.
> 
> Better yet, call the language "sex". Do you have any idea what kind of
> publicity we'd get? Not to mention how many google searches.

man.. :)) the biggest point in this thread :DD
btw in my country not much, because we write it "szex" :DD

tsabi
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Dotan Cohen
On 01/12/2007, Aaron Watters <[EMAIL PROTECTED]> wrote:
> On Nov 30, 9:58 am, [EMAIL PROTECTED] wrote:
> > Now, python3000 is coming. It's the best time to rename!
>
> Yes, but "Thong" would be a better name,
> due to the minimalist syntax and the
> attraction/repulsion/catatonic revulsion effect it has with
> different people from different cultural backgrounds.

Better yet, call the language "sex". Do you have any idea what kind of
publicity we'd get? Not to mention how many google searches.

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Dotan Cohen
On 30/11/2007, Gerardo Herzig <[EMAIL PROTECTED]> wrote:
> You will be eaten by the Snake-Ra god tonight!

Wasn't Ra the Sun god?

Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Sorting array

2007-12-01 Thread Tartifola


Hi,

On Fri, 30 Nov 2007 14:55:08 -0600
Robert Kern <[EMAIL PROTECTED]> wrote:

> Tartifola wrote:
> > 
> > Hi,
> > I'm working with numerical array and I'm a little lost on a particular
> > sorting of one of them. In particular I have an array like
> > 
> > a = array([[8,4,1],[2,0,9]])
> > 
> > and I need to sort it using only the first column as reference but
> > keeping the lines together so to obtain
> > 
> > array([[2, 0, 9],
> >[8, 4, 1]])
> 
> In [1]: from numpy import *
> 
> In [2]: a = array([[8,4,1],[2,0,9]])
> 
> In [3]: i = argsort(a[:,0])
> 
> In [4]: a[i]
> Out[4]:
> array([[2, 0, 9],
>[8, 4, 1]])
> 
> 
> numpy questions are best asked on the numpy-discussion mailing list since
> everyone there automatically knows that you are talking about numpy arrays and
> not just misnaming lists.  ;-)
> 
>   http://www.scipy.org/Mailing_Lists
> 

thanks a lot for your help and sorry for using the wrong list.


> -- 
> Robert Kern
> 
> "I have come to believe that the whole world is an enigma, a harmless enigma
>  that is made terrible by our own mad attempt to interpret it as though it had
>  an underlying truth."
>   -- Umberto Eco
> 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Check if a symlink is broken or circular

2007-12-01 Thread Giampaolo Rodola'
On 1 Dic, 00:10, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> > I would like to know if such function would be correct for verifying
> > if a link is broken and/or circular.
>
> > def isvalidlink(path):
> > assert os.path.islink(path)
> > try:
> > os.stat(path)
> > except os.error:
> > return 1
> > return 0
>
> You meant to flip the result values, right? 1 should mean that the
> link is value, and 0 that it is not.
>
> Mostly. If the link is correct, but you don't have permission to stat
> the target file, you get 0. OTOH, in that case, you have no way of
> finding out whether the link *is* correct.
>
> Still, you could try to detect the errnos that indicate a problem
> with the link itself, and pass all other errors through.
>
> Regards,
> Martin

Mmmm... do you mean something like this?
Could it be ok?



import os, errno

def isvalidlink(path):
assert os.path.lexists(path)
try:
os.stat(path)
except os.error, err:
# broken link
# "No such file or directory"
if err.errno == errno.ENOENT:
return 1
# circular link
# "Too many levels of symlinks"
elif err.errno == errno.ELOOP:
return 2
# something else occurred,
# assume it as invalid anyway
else:
return 3
return 0

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: importing a user file in Python

2007-12-01 Thread Rick Dooling
On Dec 1, 1:42 am, waltbrad <[EMAIL PROTECTED]> wrote:

> Hello. I'm brand new to Python.
>
> Where on my system do I have to place these files before the
> interpreter will import them?
>

In this case, odbchelper.py is a module you are trying to import.

http://docs.python.org/tut/node8.html

One suggestion is to make a directory in your /home dir where you keep
your downloaded and homemade Python modules and scripts. I call mine
"Python" so it's ~/Python or /home/rick/Python.

Then, as suggested, add this dir to your Python path, so that you can
import your custom modules (with import odbchelper).

You may also want to add that dir to your system path, so that you can
call your Python scripts from anywhere without having to change back
to the ~/Python directory:

export PATH=~/Python:~/bin:$PATH

Here I've added two directories: Python and bin to $Path so that the
system knows to look for executables there.

Good luck.

Rick
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Tim Chase
> I agree that Python is not a good name for a programming language, but
> I'm afraid we're stuck with it.

Well, the language was going to be called "One of the cross beams
has gone out askew on the treadle" but that was a little unwieldy
and hard to understand when mumbled in a hury.  Searching for the
runtime "ootcbhgoaott" returns zero hits on Google.  That would
have guaranteed that the only hits that came back related to the
language.  However typing things like

 sh$ ootcbhgoaott myprog.ootcbhgoaott

became too cumbersome.  So they decided on Python instead.

Besides...nobody expected a kind of Spanish Inquisition...

Just-making-stuff-up'ly yers,

-tkc



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Show this file in explorer"

2007-12-01 Thread Tim Golden
farsheed wrote:
> That was great. Thanks so so much.
> can you tell me where can I find that kind of trips?

(assuming "kind of tips")

I stuck "explorer command line options" into Google and... Bingo!
(All right, I'm cheating a bit: I knew that explorer *had* command
line options because I've been around a bit).

http://support.microsoft.com/kb/152457

TJG
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread David H Wild
In article <[EMAIL PROTECTED]>,
   greg <[EMAIL PROTECTED]> wrote:
> Not necessarily. A python is a sleek and powerful
> creature, which are good associations for a programming
> language. The word also hints at a bit of danger and
> excitement. On the whole, I think it's a good name.

I remember reading an interview with a young woman who danced with a python
across her shoulders and down her arms. The interviewer asked if she was
afraid when she danced. She replied that she was afraid that the python
would go to sleep if she didn't keep him moving.

-- 
David Wild using RISC OS on broadband
www.davidhwild.me.uk
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Show this file in explorer"

2007-12-01 Thread farsheed
That was great. Thanks so so much.
can you tell me where can I find that kind of trips?
Thanks Again.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread MonkeeSage
On Dec 1, 4:11 am, Bjoern Schliessmann  wrote:
> [EMAIL PROTECTED] wrote:
> > New name "Pytn" may be better, do you think so ?
>
> No. How would you pronounce it? Pai-tn?
>
> Why don't you create a fork where the only difference is the name?
>
> Regards,
>
> Björn
>
> --
> BOFH excuse #194:
>
> We only support a 1200 bps connection.

My vote is for "Pyrotron [1] 10,000", heh. ;)

[1] http://en.wikipedia.org/wiki/Disintegrator_ray

Regards,
Jordan
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Show this file in explorer"

2007-12-01 Thread Tim Golden
farsheed wrote:
> I have a big problem. I have a list of files that my script find and
> list them in a little gui.
> I need this function:
> 
> when i d-click on each item, I want explorer opens and selects that
> item inside windows explorer.
> like that beautiful buttom in iTunes.

Experiment with:

explorer.exe /select,


TJG
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote:
> New name "Pytn" may be better, do you think so ?

No. How would you pronounce it? Pai-tn?

Why don't you create a fork where the only difference is the name?

Regards,


Björn

-- 
BOFH excuse #194:

We only support a 1200 bps connection.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Bjoern Schliessmann
Russ P. wrote:
> I agree that Python is not a good name for a programming language,

Why not? 

BTW, is "Windows" a great name for an operating system? 

> If I had invented Python, I would have called it Newton or Euler,
> arguably the greatest scientist and mathematician ever,
> respectively. Then again, if pigs could fly ...

Really "unique" names; the OP wouldn't be happy about it when using
google ;)

> Speaking of stupid names, what does "C++" mean? 

It's "C incremented".

> I think it's the grade you get when you just barely missed
> a "B--".  

So what dou you think about D language? :) Or F or F#?

Regards,


Björn

-- 
BOFH excuse #302:

microelectronic Riemannian curved-space fault in write-only file
system

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Show this file in explorer"

2007-12-01 Thread Sergio Correia
Although I'm a python fan; for that kind of stuff, I use autohotkey (
http://www.autohotkey.com/download/ )

Best,
Sergio

On Dec 1, 2007 3:30 AM, farsheed <[EMAIL PROTECTED]> wrote:
> I have a big problem. I have a list of files that my script find and
> list them in a little gui.
> I need this function:
>
> when i d-click on each item, I want explorer opens and selects that
> item inside windows explorer.
> like that beautiful buttom in iTunes.
>
> Thanks in advane.
>
> Farshid Ashouri.
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


os.access() under windows

2007-12-01 Thread Yann Leboulanger
Hi,

Under Windows XP os.access has a strange behaviour:

I create a folder test under e:

then os.access('e:\\test', os.W_OK) returns True. Everything's ok.

Now I move My Documents to this e:\test folder

Then os.access('e:\\test', os.W_OK) returns False !!

but this works:
f = open('e:\\test\\test', 'a')
f.write('abc')
f.close()

So why os.access returns False ?

-- 
Yann
-- 
http://mail.python.org/mailman/listinfo/python-list


Pyro and sqlite3 problem

2007-12-01 Thread Sébastien Ramage

Hi !

I'm trying to build an client/server app based on Pyro and sqlite3.
But I have a problem using sqlite3 on the server

I got this error :

sqlite3.ProgrammingError: ('SQLite objects created in a thread can
only be used
in that same thread.The object was created in thread id 240 and this
is thread i
d 4068', 'This error occured remotely (Pyro). Remote traceback is
available.')

what can I do to avoid this ?

I'm using Python 2.5.1,Pyro 3.7  under Windows

Sébastien
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: 25 MOST FREQUENTLY ASKED QUESTIONS ABOUT ISLAM

2007-12-01 Thread farsheed
No , I tell you in brief what exactlly Islam is. (I know this is now a
good location but excuse me this time)

I was muslem for 25 years and happily not now. I read quran (muslem's
book) every day and it is full of inhuman words.
rozbeh(salman) and mohhamad made this book to **ck their people. if
you are a muslem you probebly be angry when you read this comment but
search about the rozbeh(salman) and his powerfull influence on
muhammad. muhammad had 40 wifes (**cking ***hole) and killed too many
poeple that you can't imagine. ali also was a killer and they all
where super super terrorists.

keep this in your mind:

20% of world is real
80% is what you made in your mind.
-- 
http://mail.python.org/mailman/listinfo/python-list


C/C++ on UNIX Developer required in Woodmead, Johannesburg

2007-12-01 Thread arnold
We seek the following sort of experience / skill for developer
resources (if u do not qualify - we offer a handsome referral fee if
you refer someone that is succesfully placed:-) .

C Programming  5 years
C++ Programming  2 years
SQL Programming  2 years
Software Design  2 years
Software Engineering Process  3 years
GUI Development 1 year
Unix/Linux environment 2 years
Scientific/Mathematical Programming  2 years


These skills all need to be current.


The candidate should demonstrate an ability to work resourcefully and
independently, whilst delivering in the framework of a team.  The
candidate must also demonstrate a willingness and desire to program
hands-on in C and C++ code.  He/she must have personally developed
significant amounts of program code, demonstrating and requiring
modular design and the use of a source code repository for version
control.


The candidate must communicate well, and be comfortable discussing
design issues with both the team and the customer.  His / her present
role should require this of him/her.


The candidate must be able to describe the software development
lifecycle and identify his/her personal points of interaction in that
cycle. These points must be Functional Requirements Specification,
Software Design, Programming and Unit Testing.


The following skills would be an advantage:
   Object oriented design
   UML and the use of design tools like Rational Rose
   Development tools (GDB, DBX, WxWidets/Qt/GTK, Makefiles
etc.)


-- 
http://mail.python.org/mailman/listinfo/python-list


"Show this file in explorer"

2007-12-01 Thread farsheed
I have a big problem. I have a list of files that my script find and
list them in a little gui.
I need this function:

when i d-click on each item, I want explorer opens and selects that
item inside windows explorer.
like that beautiful buttom in iTunes.

Thanks in advane.

Farshid Ashouri.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: "Python" is not a good name, should rename to "Athon"

2007-12-01 Thread Rod Stephenson
At one stage, "Monty Python's Flying Circus" was going to be called
"Owl Stretching Time".

If that had eventuated, then presumably we would all be disussing the Owl
programming language on  comp.lang.owl

-- 
Real email address? Rule 1. 
-- 
http://mail.python.org/mailman/listinfo/python-list