Re: reading/writing files

2007-11-27 Thread BartlebyScrivener
On Nov 27, 7:14 am, sandipm [EMAIL PROTECTED] wrote:
 f1= open(file1.pdf, rb)
 x = f1.read()
 open(file2.pdf, wb).write(x)

 works...

 thanks
 sandip

You might also like:

http://pybrary.net/pyPdf/

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


Re: Books on Python

2007-11-27 Thread BartlebyScrivener
On Nov 27, 9:05 pm, barcaroller [EMAIL PROTECTED] wrote:
 Can someone kindly recommend some good books on the following:

 Python for beginners
 Python for advanced users


http://wiki.python.org/moin/PythonBooks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python web frameworks

2007-11-23 Thread BartlebyScrivener
I'm just learning Django and feeling my way through all of this server
terminology. Where does Django's memcached feature fit into all of
this? When you all speak of start up costs and memory intensive
loading for each requests, doesn't the caching feature eliminate most
of that overhead?

http://www.djangoproject.com/documentation/cache/

I'm probably mixing appliances and oragutans but just curious about
how you experts feel about Django's caching.

rd

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


Re: Python web frameworks

2007-11-21 Thread BartlebyScrivener
On Nov 21, 4:42 am, joe jacob [EMAIL PROTECTED] wrote:
 Django is best among the frameworks so I
 downloaded it and I found it very difficult to configure. I referred
 the djangobook.

It's not a turnkey type thing like WordPress or Joomla. It's a
webframework. Also watch versions. The book examples work only in .
96.  It's easy in the tutorial to stray into docs for .95 or SVN. I
think that's part of the confusion.

rd


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


Re: Python web frameworks

2007-11-20 Thread BartlebyScrivener
On Nov 20, 6:19 am, joe jacob [EMAIL PROTECTED] wrote:
 There are a lot of web frameworks for python like django, mod_python,
 spyce, turbo gears, Zope, Cherrypy etc. Which one is the best in terms
 of performance and ease of study.

I'm looking at django mainly. I hope the veterans jump in with the
latest on these. The django book (written by the developers) comes out
12/7. Django comes with its own little server so that you don't have
to set up Apache on your desktop to play with it. Configuration is
tricky at first, but what fun to code a web app in Python instead of
looking up php commands all day.

Drafts of the django book are available at the site. I would follow
the examples in the book instead of the tutorial. The tutorial works,
but I seemed to learn more using the examples in the book.

As for performance, see the page on caching. I barely understand the
server dynamics but you can find pages and sites comparing dango
performance to ruby on rails.

http://www.djangoproject.com/documentation/cache/

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


Re: Python web frameworks

2007-11-20 Thread BartlebyScrivener
On Nov 20, 3:39 pm, Graham Dumpleton [EMAIL PROTECTED]
wrote:

 This only holds if actually hosted on Apache. As Django these days
 supports WSGI interface there is nothing to stop it being run with
 other hosting solutions that support WSGI. So, you could host it under
 paster or CherryPy WSGI servers. You could even run it under CGI if
 you were really desperate using a CGI-WSGI adapter. So, it isn't
 strictly correct to say it is as a multiprocess framework specifically
 for mod_python, although the developers will admit in the first
 instance that they didn't design the internals with multithreading in
 mind. That said, there aren't believed to be any multithreading issues
 in Django itself at this time.

 People keep pushing this barrow about the GIL and multithreading being
 a huge problem, when in the context of Apache it is isn't, at least
 not to the degree people make out. The reason for this is that when
 using worker MPM it sill acts as a multi process web server even
 though each process is also multithreaded. Within those worker MPM
 child processes there is also a lot going on that doesn't involve
 Python code nor the GIL, for example initial request process and
 serving up of static files etc.

 Result is that the Python GIL is no impediment when using Apache on
 UNIX to making good use of multiple processors or cores, even when
 Apache worker MPM is used.


I understand about a fifth of this exchange but I'm glad it's here so
I can follow links and search on the terminology. I couldn't tell from
earlier posts if mod_python was good or bad.

The Django book says: Apache with mod_python currently is the most
robust setup for using Django on a production server.

Is that true?  And if you start small with, say, an online arts
magazine for a metropolitan area, then can we easily scale if we
become popular?  I'm picking Django because it sounds like they did
just this with a newspaper site in Lawrence, Kansas.

We are thinking of starting with Webfaction and just seeing what
happens. All I know is that I like Python and Django and would rather
stick with open source.

Thanks for the info.

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


Re: Python too complex ?!?!?!

2007-11-17 Thread BartlebyScrivener
On Nov 17, 7:46 am, Brian [EMAIL PROTECTED] wrote:
 This person is a long-term Linux/C/Python
 programmer, but he claims that the install, config, and
 library models for C# have proved to be less
 problematic than Python.

If his students have problems installing Python on Windows, show him
this.

http://tinyurl.com/w7wgp

It can't get any easier.

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


Re: subprocess chokes on spaces in path

2007-11-07 Thread BartlebyScrivener
On Nov 6, 2:48 pm, Gabriel Genellina [EMAIL PROTECTED] wrote:

 Use a list of arguments [antiword, word_doc] and let subprocess handle the
 spaces the right way.


Got it working. Thank you both.

p = subprocess.Popen([antiword, word_doc], stdout=subprocess.PIPE)
doc_text = p.stdout.read()

rd




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


Re: regular expression syntax the same in Python, Perl and grep?

2007-11-07 Thread BartlebyScrivener
On Nov 7, 12:11 pm, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
 How similar is Python's re module (regular expressions) compared
 to Perl's and grep's regular expression syntaxes?

http://en.wikipedia.org/wiki/Comparison_of_regular_expression_engines

rd


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


subprocess chokes on spaces in path

2007-11-06 Thread BartlebyScrivener
Using bash on Debian Etch.

If word_doc = sys.argv[1] and it's a file name like My\ Word.doc this
function reads My and Word as two separate files unless the second
'%s' is quoted.  Took me a lot of trial and error to discover. Is this
the most elegant way to do it? I was using popen originally, then saw
some threads suggesting subprocess cured the spaces in path problem.

def get_MSWordDoc_text(word_doc):
Harvests text from an MSWord doc using antiword.
antiword = /usr/bin/antiword

# Note the extra single quotes around the second '%s'
# without these quotes, bash chokes on paths with spaces in them
# says can't open My ; can't open Word
# using new subprocess module, the extra '%s' shouldn't be
necessary?
# but I could not get to work
# see Beazley 2nd Ed. page 340

p = subprocess.Popen(%s '%s' % (antiword, word_doc), shell=True,
stdout=subprocess.PIPE)
doc_text = p.stdout.read()
return doc_text

thx,

rd

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


Re: how to keep order key in a dictionary

2007-11-04 Thread BartlebyScrivener
On Nov 4, 7:19 am, azrael [EMAIL PROTECTED] wrote:

  For this dictionary it is realy
 important to keep the right order. Is it possible to arange them in a
 specific order?

Not sure what order you want, but how about sorting the keys?

def printdict(dict):
print sorted key:value pairs
keys = dict.keys()
keys.sort()
for key in keys:
print key, :, dict[key]

from Python Visual Quickstart, Chris Fehily p. 157

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


Re: Python IDE

2007-11-03 Thread BartlebyScrivener
On Nov 3, 9:11 am, Simon Pickles [EMAIL PROTECTED] wrote:

I need a Python IDE and debugger . . .

I use vim on both Windows XP and Debian, but I used to use Komodo for
big projects.

Try the free trial of Komodo

http://www.activestate.com/Products/komodo_ide/

It has what you want, and it comes with licenses for both Windows and
Linux.

rd

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


Re: python newbie

2007-11-02 Thread BartlebyScrivener
On Nov 2, 8:51 am, Jim Hendricks [EMAIL PROTECTED] wrote:
 New to python, programming in 15 or so langs for 24 years.

 Couple of questions the tuts I've looked at don't explain:

Did you look at THE tut?  You would seem to be the perfect reader for
it, because you are already a programmer.

http://docs.python.org/tut/node6.html#SECTION00660

rd

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


Re: python newbie

2007-11-02 Thread BartlebyScrivener
On Nov 2, 10:13 am, Jim Hendricks [EMAIL PROTECTED] wrote:

 Here's an example of what I am asking:

Try this example from Beazley (pg 82)

a = 42
def foo():
a = 13
foo()
print a
42

By contrast:

a = 42
b = 13
def foo():
global a, b
a = 13
b = 0
foo()
print a
13
print b
0

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


python tutorial on a single html page?

2007-11-02 Thread BartlebyScrivener
Is the main Python tutorial posted on single searchable page
somewhere?  As opposed to browsing the index and clicking NEXT etc.

Thank you,

rd

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


Re: python in academics?

2007-10-30 Thread BartlebyScrivener
On Oct 29, 10:39 pm, sandipm [EMAIL PROTECTED] wrote:
 seeing posts from students on group. I am curious to know, Do they
 teach python in academic courses in universities?

This came up a while back. See:

http://tinyurl.com/2pjjua

If that doesn't work, search the Google group for Python taught in
schools

rd

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


Re: python2.5 and mysqldb

2007-10-30 Thread BartlebyScrivener
On Oct 29, 2:30 pm, brad [EMAIL PROTECTED] wrote:

 or get a
 more flexible OS that easily allows for this sort of thing (like Debian)

Second that. Etch came with 2.3 and 2.4, and I added 2.5 and they
never bother each other.

rd


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


Re: Readline and record separator

2007-10-30 Thread BartlebyScrivener
On Oct 30, 7:21 am, Johny [EMAIL PROTECTED] wrote:
 My problem is that my record consits several '\n' and when I use
 readline it does NOT read the whole my record.
 So If I could change '\n' as  a record separator for readline, it
 would solve my problem.

Python Cookbook (great book!) 2nd Ed pg. 717: Iterating on a Stream
of Data Blocks as a Stream of Lines.

Allows you to specify both eol for source and output file.

rd

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


Re: how to creating html files with python

2007-10-27 Thread BartlebyScrivener
On Oct 27, 12:02 pm, George Sakkis [EMAIL PROTECTED] wrote:

 The only strange thing here is that you think this is a strange
 requirement :) This is quite typical, and practically required for web
 development.

I was wondering about this myself the other day. Suppose you wanted to
get by on the cheap without setting up a whole new Joomla or WordPress
installation for another smallish blog or website where you are the
only poster, and all you need is simple CMS.

How hard would it be to create, say, a calendar of events, or news
postings using MySQL and Python and HTML. Create the page on your
local machine using Python templating, and then just post the HTML
code daily?

I'm a rank amateur, but was wondering if this is silly and making
work, or if one of those templating systems you all are mentioning
would work for simple CMS and calendaring?

Thanks,

rd


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


pydoc script.py vs. pydoc scriptpy

2007-10-20 Thread BartlebyScrivener
On Debian Etch, if ~/mypyscripts is in my bash PATH and also in
PYTHONPATH, I get the following pydoc behaviors. Maybe this is
intentional. I'm just checking to be sure I don't have something
misconfigured in my environment.

If I have two scripts or modules  in ~/mypyscripts: one script.py and
one scriptpy (no extension), and do:

$pydoc script

I get the documentation strings for script.py.

However, if I do:

$pydoc scriptpy

I get no doc strings, even if I am in the ~/mypyscripts directory,
error message:
no Python documentation found for 'scriptpy'

Instead I must do:

$pydoc ~/mypyscripts/scriptpy

even though ~/mypyscripts is in both PATH and PYTHONPATH

Took me awhile to sort this out. Is this the way pydoc is supposed to
work?

thanks,

rpd

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


Re: vi and python

2007-09-14 Thread BartlebyScrivener
On Sep 14, 7:35 pm, Danyelle Gragsone [EMAIL PROTECTED] wrote:
 Good Evening,

 I am running gentoo.  I want to use vi to program in python.  I
 wondered are there any other gentooovians out there who know if python
 support is already installed.

http://tinyurl.com/2mzakm

rd

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


Re: Search path for python script

2007-09-12 Thread BartlebyScrivener
On Sep 12, 4:40 pm, grt [EMAIL PROTECTED] wrote:

 I'm trying to run a script by typing:

 python test.py


What happens if you just type:

test.py  or test

and hit Enter?

rd

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


Re: Is a Borg rebellion possible? (a metaclass question)

2007-09-07 Thread BartlebyScrivener
On Sep 7, 1:53 pm, Steve Holden [EMAIL PROTECTED] wrote:

 All you really need is to create your SplinterBorgs with appropriate
 group names, you don't neef subclasses at all:


Dang. With that subject heading I thought this was about some post-
Singularity, Python-programmed cyborgs rising up to take over the
universe.

See, e.g.
a href=http://www.amazon.com/How-Survive-Robot-Uprising-Defending/dp/
1582345929/inscape-20How To Survive A Robot Uprising/a

I am officially misled!

rd

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


Re: Is a Borg rebellion possible? (a metaclass question)

2007-09-07 Thread BartlebyScrivener
On Sep 7, 1:53 pm, Steve Holden [EMAIL PROTECTED] wrote:

 All you really need is to create your SplinterBorgs with appropriate
 group names, you don't neef subclasses at all:

oops, I tried this once and the link broke. I'll try tinyurl.

Dang. With that subject heading I thought this was about some post-
Singularity, Python-programmed cyborgs rising up to take over the
universe.

See, e.g.
How To Survive A Robot Uprising
http://tinyurl.com/yrk5pw

I am officially misled!

rd


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


Re: why should I learn python

2007-09-06 Thread BartlebyScrivener
On Sep 6, 5:36 pm, André [EMAIL PROTECTED] wrote:

 Easy to read, easy to write, good libraries and, I have found, an
 extremely helpful community.

 Hobbyists (like me) can work on projects written in Python on and off
 (sometimes for weeks if not months without programming) and be able to
 resume the work very quickly (because it's so easy to read and
 understand the code).


I second these.  I am not a programmer. You can get busy with other
projects for weeks and come back to Python code and pick up where you
left off, because it uses WORDS.  Try remembering what () or *
means after being away from Perl for a month.

rd

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

Re: Baby Steps, optionDB

2007-08-22 Thread BartlebyScrivener
On Aug 22, 10:41 pm, W. Watson [EMAIL PROTECTED] wrote:

 clError: couldn't open optionDB: no such file or directory

Because the file doesn't exist?

Did you make an optionDB file?

http://tinyurl.com/283o98


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


Re: A problem with Time

2007-08-16 Thread BartlebyScrivener
On Aug 16, 10:54 am, Diez B. Roggisch [EMAIL PROTECTED] wrote:

 RTFM is the answer...

I don't know. I remember scratching my head for a day or two over the
module explanations and instructions until I found a little howto with
a lot of explicite examples.

http://pleac.sourceforge.net/pleac_python/datesandtimes.html

rd

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


Re: Simple python iteration question

2007-08-15 Thread BartlebyScrivener
On Aug 14, 11:59 am, Shawn Milochik [EMAIL PROTECTED] wrote:

 Just for my own sanity: Isn't this the third response advocating the
 use of enumerate()? Did the other responses not get through, or was
 this a time-delay thing?

 Thanks,
 Shawn

Look at the timestamps.  All within ten minutes. And those ten minutes
are spent keyboarding your response in and posting, plus it takes
several minutes for the posts to appear on Google Groups.

rd


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


Re: 'Advanced' list comprehension? query

2007-08-08 Thread BartlebyScrivener
On Aug 8, 11:00 am, [EMAIL PROTECTED] wrote:
 Hi,

 I'm playing around with list comprehension, and I'm trying to find the
 most aesthetic way to do the following:

 I have two lists:

 noShowList = ['one', 'two', 'three']

 myList = ['item one', 'item four', 'three item']

 I want to show all the items from 'myList' that do not contain any of
 the strings in 'noShowList'.

I'm still learning these myself, but I think what you want is
itertools:

http://docs.python.org/lib/module-itertools.html


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


Re: the one python book

2007-08-04 Thread BartlebyScrivener
On Aug 4, 8:23 am, dhr [EMAIL PROTECTED] wrote:
 newbie question:

 Is there a 'KR type of Python book? The book that you'd better have on
 your shelf if you are going into Python?

I second the comment about the Official Python Tutorial, however you
did say, on the shelf in which case I would recommend:

Python Essential Reference, David Beazley, 3rd edition Feb 2006
great, esp. if you already know some other programming language.

http://tinyurl.com/38f5mh

rd

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


Re: i am new to python-Please somebody help

2007-08-02 Thread BartlebyScrivener
On Aug 2, 4:31 am, [EMAIL PROTECTED] wrote:

 i want the packages file with
 a .gz extension by implementing a python program

http://docs.python.org/lib/module-gzip.html

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


Re: how to get next month string?

2007-07-24 Thread BartlebyScrivener
On Jul 24, 5:31 am, Yinghe Chen [EMAIL PROTECTED] wrote:
 Hi,
 Could someone help on how to use python to output the next month string like
 this?

 AUG07, suppose now is July 2007.


I usually find time and date answers somewhere in here:

http://pleac.sourceforge.net/pleac_python/datesandtimes.html

rd

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


Re: Where do they tech Python officialy ?

2007-07-23 Thread BartlebyScrivener
On Jul 23, 11:52 am, NicolasG [EMAIL PROTECTED] wrote:

 Does some one have any suggestions on which University to attend ?
 Alternatives solutions are welcome..

You might like this thread.  Or go to comp.lang.python and search for
python taught in schools

http://tinyurl.com/2zlsxl

rd

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


Re: Python and Tkinter Primer/Tutorial?

2007-07-15 Thread BartlebyScrivener
On Jul 15, 9:46 am, W. Watson [EMAIL PROTECTED] wrote:
 Is there a primer out there on these two items? I have the Python tutorial,
 but would like either a Tkinter tutorial/primer to supplement it, or a
 primer/tutorial that addresses both.

http://www.freenetpages.co.uk/hp/alan.gauld/tutgui.htm

rd

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


Re: Learning Basics

2007-07-09 Thread BartlebyScrivener
On Jul 8, 12:10 pm, Brad [EMAIL PROTECTED] wrote:

 So I'd appreciate some good feedback or ideas.

I addition to Dan's suggestions, you could add a Tk text entry box to
make it easier to enter text.

I can send you some code if you'd like, as Steve Holden just
generously helped me make a text entry box for my quote database.  Or
you can make your own starting here:

 Alan Gauld's GUI Programming with Tkinter
 http://www.freenetpages.co.uk/hp/alan.gauld/tutgui.htm

These also came in very handy for cutting and pasting.

Jeff Eppler's clp post - 3 August 2005
cut and paste text between Tkinter widgets
http://tinyurl.com/2d97gj

rd

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


Re: Evolution of a pythonistas!

2007-06-28 Thread BartlebyScrivener
On Jun 28, 6:46 am, swordofrue [EMAIL PROTECTED] wrote:
 Hello everyone,

 How does a pythonistas evolve?


Get the Python Cookbook 2d, pick a useful looking project, and adapt
it for your own needs. Learn by doing. Some people enjoy just doing
the tutorials with the interpreter open, testing code line by line.
That works, too. But often the most gratifying is to solve a problem,
or make a useful script that does something you need, which saves you
time--time you can invest in learning more Python. :)

rd

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


Re: Evolution of a pythonistas!

2007-06-28 Thread BartlebyScrivener
On Jun 28, 8:02 am, Sells, Fred [EMAIL PROTECTED] wrote:
 concur 100%.
snip
 Get a python aware editor.  I use Eclipse+PyDev for big jobs, but still use
 Emacs with python-mode for quickies.

Just when I was thinking we agreed! :)

Get Vim!

http://www.vim.org

And the Cookbook

http://www.amazon.com/Python-Cookbook-Alex-Martelli/dp/0596007973/inscape-20

That's all you need.

rd

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


Re: The Modernization of Emacs: terminology buffer and keybinding

2007-06-22 Thread BartlebyScrivener
On Jun 22, 3:47 pm, Twisted [EMAIL PROTECTED] wrote:

 If it requires years of mastery, it is clunky

Well, now you keep harping on this, but it's just not true.

I use vim myself, but for purposes of this argument it doesn't matter.
If you take the Vim tutorial and use the help (which appears in a
split window anytime you want it), you can use Vim like any other text
editor within a day or so, especially if you use Cream, which is set
up to hold your Windows hands and act like any other Windows text
editor on the surface. But if you use Vim for YEARS you get better and
faster and more efficient precisely BECAUSE of its arcane
capabilities. If you are going to keep your hands on the keyboard
where they belong, if you REALLY want to go fast, then there's no
alternative to having complex key commands, which become second nature
over time, and take the place of repetitive, totally inefficient
mousing around.

You might enjoy this. Especially the link to an old essay called
Interface Zen

http://tinyurl.com/2da3om

rd


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


Re: The Modernization of Emacs

2007-06-20 Thread BartlebyScrivener
On Jun 17, 10:13 am, Xah Lee [EMAIL PROTECTED] wrote:
 [this post is a excerpt from
 The Modernization of Emacs
 
 SIMPLE CHANGES

At the command line, change emacs to gvim

http://pinard.progiciels-bpi.ca/opinions/editors.html

rd

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


Re: The Modernization of Emacs

2007-06-20 Thread BartlebyScrivener
On Jun 20, 3:53 pm, Twisted [EMAIL PROTECTED] wrote:
 On Jun 20, 4:21 pm, BartlebyScrivener [EMAIL PROTECTED] wrote:

  On Jun 17, 10:13 am, Xah Lee [EMAIL PROTECTED] wrote:

   [this post is a excerpt from
   The Modernization of Emacs
   
   SIMPLE CHANGES

  At the command line, change emacs to gvim

 Out of the frying pan and into the fire...

Nah.

http://www.debian-administration.org/polls/89

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


Re: Python IDE

2007-06-19 Thread BartlebyScrivener
On Jun 19, 5:39 am, Tom Gur [EMAIL PROTECTED] wrote:
 Hi,
 which IDE would you recommend for a python ?

VIM

But if you crave distraction.

http://wiki.python.org/moin/PythonEditors

rd

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


Re: Want to learn Python

2007-06-15 Thread BartlebyScrivener
On Jun 15, 6:41 am, Amol [EMAIL PROTECTED] wrote:
 Hi, I want to learn Python in less than a month which resources should
 I use. I prefer to read books . Please give me a list of *recognized*
 resources. Thank You all

Python Essential Reference, David Beazley, 3rd edition Feb 2006
great, esp. if you already know some other programming language

http://www.amazon.com/Python-Essential-Reference-Developers-Library/dp/0672328623/inscape-20

rd

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


Re: How to save python codes in files?

2007-06-14 Thread BartlebyScrivener
On Jun 13, 12:04 am, why? [EMAIL PROTECTED] wrote:
 Im working with Python 2.2 on my red hat linux system. Is there any
 way to write python codes in separate files and save them so that i
 can view/edit them in the future? Actually I've just started with
 python and would be grateful for a response. Thanx!

In addition to the help you've already received, you need:

http://wiki.python.org/moin/BeginnersGuide

It doesn't seem to be loading at the moment, but it will soon, I
suspect.

Otherwise, go to

http://tinyurl.com/w7wgp

Skip the installation instructions (for Windows) and go to the four
references and links under the image of the PythonWin interpreter.

HTH

rd

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


Re: Accessing attributes?

2007-06-12 Thread BartlebyScrivener
On Jun 12, 5:04 am, Jeff Rollin [EMAIL PROTECTED] wrote:
 Where am I going wrong?

 Many TIA for any help.

Look at your code, then look at swaroop's

http://tinyurl.com/2v5zze

Line up all your defs at the same indent and they should work.


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


Re: VIM editor question

2007-06-09 Thread BartlebyScrivener
On Jun 9, 1:14 am, Jerry VanBrimmer [EMAIL PROTECTED] wrote:

 In your vim configuration file enter:

 colorscheme name

 Example:

 colorscheme elflord

 Restart  vim.

No! That's completely wrong.

It should be:

colorscheme moria
set bg=dark

http://www.vim.org/scripts/script.php?script_id=1464



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


Re: VIM editor question

2007-06-09 Thread BartlebyScrivener
On Jun 9, 9:56 am, Joe Riopel [EMAIL PROTECTED] wrote:
 I use vim on both Windows and UNIX/Linux, and found this vimrc 
 file.http://darksmile.net/software/.vimrc.html

 It's pretty good and has good comments. You might want to take a look
 at that and customize it.

 Plus this is 
 great:http://www.usf.uni-osnabrueck.de/infoservice/doc/localhtml/vim/if_pyt...

This one also good, especially for those of us who sometimes wrap
text:

http://www.cs.cornell.edu/~djm/ubuntu/vimrc.txt

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


Re: VIM editor question

2007-06-09 Thread BartlebyScrivener
On Jun 9, 1:23 pm, Jerry Van Brimmer [EMAIL PROTECTED] wrote:
 On 6/9/07, BartlebyScrivener [EMAIL PROTECTED] wrote:

  No! That's completely wrong.

 No, it's not *completely* wrong. Yes, I should have mentioned the
 bg=dark entry, but that doesn't make it *completely* wrong. you're
 just showing your preference for the moria colorscheme, which is fine,
 but don't say my suggestion is *completely* wrong.


Er, I was kidding. Point being, it's totally customizable.

I guess I should have included a smiley face for your literal-minded
self.

rd

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


Re: Baffled on Windows.

2007-06-07 Thread BartlebyScrivener
On Jun 7, 8:17 am, Neil Cerutti [EMAIL PROTECTED] wrote:
 I have the following Python program:

 Running this program with 2.5.1 causes another Python script in
 the same directory to be loaded . . . 'new.py'

A good habit for naming your scripts: If you have a script and you
want to name it text.py, or list.py or new.py or old.py or some common
name that might be found in the thousand and one other modules and
programs in your various installations, just use my_text.py or
my_list.py or neil_new.py or something to reduce the chances that
you'll be shadowing without knowing it.

rick


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


Re: MySQL InterfaceError

2007-06-07 Thread BartlebyScrivener
On Jun 7, 10:09 am, Joe [EMAIL PROTECTED] wrote:

 And, yes, printing the error message returns absolutely nothing.  The tuple
 following InterfaceError is both the error code and message.  Unfortunately,
 it will only give me (0, '') which isn't much help.


I'm on Google groups and can't see the first part of your original
message, so don't know what query you are using. But I get that
interface error when I attempt to interpolate values from something
other than a tuple.

E.g.

SELECT item from table where item like %s

If you try to use a string, say, instead of a string in a tuple,
you'll get an interface error.

That's the only time I've gotten it.

rd

 Thanks again!

 Jough


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


Re: *args and **kwargs

2007-06-05 Thread BartlebyScrivener
On Jun 5, 7:31 am, Diez B. Roggisch [EMAIL PROTECTED] wrote:
 JonathanB wrote:
  Ok, this is probably definitely a newbie question, but I have looked
  all over the Python library reference material and tutorials which I
  can find online and I cannot find a clear definition of what these are
  and more importantly how to use them.

Also, well maybe op did not check THE tutorial. Or found explanation
too terse. But it's there.

http://docs.python.org/tut/node6.html#SECTION00660

rd




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


webbrowser.open launches firefox in background

2007-06-04 Thread BartlebyScrivener
Hello,

On Debian Etch, when I use the webbrowser.open module to launch
firefox with a url, it opens UNDER gnome terminal in the background.

If I just launch firefox from the commandline, it opens in the
foreground.

Any ideas about why? Is there a command option I'm missing.

Thanks,

Rick

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


Re: paste text with newlines into raw_input?

2007-05-31 Thread BartlebyScrivener
Thanks,

I think I need a Tkinter text entry widget, but it will take me a week
to learn how to set it up.

I'll report back.

rick

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


Re: paste text with newlines into raw_input?

2007-05-31 Thread BartlebyScrivener
Hi,

I'm going to post this here in case somebody else searches for an
example Tkinter Text Widget for entering multiline text. I don't like
GUI and don't even quite understand how it works, but it seems to
work. In my case it's part of a program for pasting a quote from the
clipboard into a MySQL database (hence the separate paste button).

I also don't know OO and Classes. If someone wants to wrap it in a
class and repost it could save the free world.

Or suggestions for making it better much appreciated.

Thanks,

Rick

-


#! /usr/bin/python
import Tkinter
import tkFont

Tkinter Text Widget for entering multline text.
Rick Dooling http://dooling.com

Based on:

Alan Gauld's GUI Programming with Tkinter
http://www.freenetpages.co.uk/hp/alan.gauld/tutgui.htm

Jeff Eppler's clp post - 3 August 2005
cut and paste text between Tkinter widgets
http://tinyurl.com/2d97gj


# the first two functions come from Jeff Eppler's post
def make_menu(w):
global the_menu
the_menu = Tkinter.Menu(w, tearoff=0)
the_menu.add_command(label=Cut)
the_menu.add_command(label=Copy)
the_menu.add_command(label=Paste)

def show_menu(e):
w = e.widget
the_menu.entryconfigure(Cut,
command=lambda: w.event_generate(Cut))
the_menu.entryconfigure(Copy,
command=lambda: w.event_generate(Copy))
the_menu.entryconfigure(Paste,
command=lambda: w.event_generate(Paste))
the_menu.tk.call(tk_popup, the_menu, e.x_root, e.y_root)

def evClear():
eText.delete(0.0,Tkinter.END)

def assign():
# get text from the text widget and assign it to Quote
Quote = eText.get(0.0, Tkinter.END)
# just for testing the assignment
print Quote

def paste():
eText.event_generate(Paste)

t = Tkinter.Tk()

# create the top level window/frame
F = Tkinter.Frame(t)
F.master.title(Enter Quote )
F.pack(expand=true)

myfont = tkFont.Font(family=Courier, size=14)

# frame for message to the troops
fMessage = Tkinter.Frame(F, border=1)
fMessage.pack(side=top, expand=true)
lMessage = Tkinter.Label(fMessage, text=Paste your quote into the
Text Box from the clipboard, or type it in. When you are finished,
click Enter.)
lMessage.pack(expand=true)

# frame for text entry field
fText = Tkinter.Frame(F, border=1)
fText.pack(side=top, expand=true)
# the text widget
eText = Tkinter.Text(fText, width= 75, height=20, font=myfont,
wrap=Tkinter.WORD); eText.pack(side=top)
eText.bind_class(Text, Button-3ButtonRelease-3, show_menu)

# frame with the buttons
fButtons = Tkinter.Frame(F, relief=groove, border=3)
# the buttons
bPaste = Tkinter.Button(fButtons, text=Paste, command=paste)
bPaste.pack(side=left, padx=15, pady=4)
bEnter = Tkinter.Button(fButtons, text=Enter, command=assign)
bEnter.pack(side=left, padx=15, pady=4)
bClear = Tkinter.Button(fButtons, text=Clear Text, command=evClear)
bClear.pack(side=left, padx=15, pady=4)
bQuit = Tkinter.Button(fButtons, text=Quit, command=F.quit)
bQuit.pack(side=left, padx=15, pady=4)
# pack them
fButtons.pack(side=bottom, expand=true)

make_menu(t)

t.mainloop()




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


paste text with newlines into raw_input?

2007-05-30 Thread BartlebyScrivener
Using Python on Debian Etch.

What is the best way to paste a block of text in at the command
prompt.

I'm trying something like:

Quote = raw_input(Paste quote here: )

Which works great for one line of text with a single newline. It gets
stripped. Okay.

Is there a way to paste in a block of text that has multiple lines and
newlines? I don't care if they all get stripped in the process, in
fact I'd prefer it. I've used strip before, but that doesn't seem to
work until you get the text into the program.

Thanks for any help.

Rick

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


Re: wxpython demo error on debian etch

2007-05-30 Thread BartlebyScrivener
On May 29, 1:09 pm, [EMAIL PROTECTED] wrote:
 The newer versions of wxPython won't make your Debian crash or
 anything. We run Debian at work and I've upgraded the Python to 2.4
 and the wxPython to its newest version. This has not affected the
 server's stability in any way.

Install like this?

Debian stable is way behind the times, so you may find something
appropriate in testing. Alternatively, the instructions below should
work.

apt-get install alien
apt-get install libgtk2.0-dev freeglut3-dev python2.3-dev
wget 
http://easynews.dl.sourceforge.net/wxpython/wxPython2.8-2.8.3.0-1.src.rpm
rpmbuild --rebuild --define 'pyver 2.3'
wxPython2.8-2.8.3.0-1.src.rpm
cd rpmdir
alien packagenames.rpm
dpkg -i whatever alien called them





 This link explains the process the Debian team takes to implement new
 versions of packages (like wxPython):http://en.wikipedia.org/wiki/Debian

 Basically, they test it for months before finally putting it in to the
 stable category. However, since they have to do this for lots of
 packages, one by one the packages get marked stable. So you could have
 something like wxPython marked stable in March and 6 months later, the
 rest of the packages are done so they're marked stable. And then after
 additional testing, they release the new version.

 Hopefully that wasn't too confusing.

 Mike


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


wxpython demo error on debian etch

2007-05-29 Thread BartlebyScrivener
If there is a wxPython on Debian user in the house? I am using the
version of the demo that came with the apt-get download of wxPython.

I thought I'd followed the instructions for installing and unpacking
the wxPython demo program. It appears to run after a fashion, but I
also get this at the commandline.

Any help much appreciated.

(python:5865): Gtk-CRITICAL **: gtk_window_realize_icon: assertion
`info-icon_pixmap == NULL' failed
Traceback (most recent call last):
  File /usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/
_misc.py, line 1286, in Notify
self.notify()
  File /usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/
_core.py, line 13637, in Notify
self.result = self.callable(*self.args, **self.kwargs)
  File /home/rick/bin/wxPython/Main.py, line 1713, in ShowMain
if self.fc.IsRunning():
  File /usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/
_core.py, line 13481, in __getattr__
raise PyDeadObjectError(self.attrStr % self._name)
wx._core.PyDeadObjectError: The C++ part of the MySplashScreen object
has been deleted, attribute access no longer allowed.

Thanks,

Rick

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


Re: wxpython demo error on debian etch

2007-05-29 Thread BartlebyScrivener
On May 29, 8:51 am, [EMAIL PROTECTED] wrote:

 The wxPython
 website details how to get the latest version of wxPython (2.8.4)

I'm fairly new to Linux, so I probably shouldn't mess with my stable
Etch.

I'll make do with this version of wxPython or go back to puzzling over
Tkinter.

Thanks,

rick

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


Re: wxpython demo error on debian etch

2007-05-29 Thread BartlebyScrivener
On May 29, 1:09 pm, [EMAIL PROTECTED] wrote:
 The newer versions of wxPython won't make your Debian crash or
 anything.

Thanks, mike, i'll try it.

rick

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


Tkinter error

2007-05-28 Thread BartlebyScrivener
Finally started trying to build a simple gui form for inserting text
data into a mysql db of quotations.

I found this nice Tkinter tutorial,

http://www.ibiblio.org/obp/py4fun/gui/tkPhone.html

but midway I'm getting an error.

from Tkinter import *

  win = Tk()
 f = Frame(win)
 b1 = Button(f, One)

Traceback (most recent call last):
  File stdin, line 1, in ?
  File /usr/lib/python2.4/lib-tk/Tkinter.py, line 1936, in __init__
Widget.__init__(self, master, 'button', cnf, kw)
  File /usr/lib/python2.4/lib-tk/Tkinter.py, line 1859, in __init__
BaseWidget._setup(self, master, cnf)
  File /usr/lib/python2.4/lib-tk/Tkinter.py, line 1839, in _setup
if cnf.has_key('name'):
AttributeError: 'str' object has no attribute 'has_key'

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


Re: Tkinter error

2007-05-28 Thread BartlebyScrivener
On May 28, 4:57 pm, Peter Otten [EMAIL PROTECTED] wrote:

  b1 = Button(win,text=One)
  b2 = Button(win,text=Two)

That worked. Thank you.

Rick

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


Re: ten small Python programs

2007-05-27 Thread BartlebyScrivener
On May 26, 1:43 pm, Steve Howell [EMAIL PROTECTED] wrote:

 --
 parentRabbits, babyRabbits = (1, 1)
 while babyRabbits  100:
 print 'This generation has %d rabbits' %
 babyRabbits
 parentRabbits, babyRabbits = (babyRabbits,
 parentRabbits + babyRabbits)

 --
 # def defines a method in Python
 def tax(itemCharge, taxRate = 0.05):
 return itemCharge * taxRate
 print '%.2f' % tax(11.35)
 print '%.2f' % tax(40.00, 0.08)


For the person new to programming (doesn't come from C or other
languages), I think you need to add a separate explanation of string
formatting and how it works, or at least add a comment that tells them
you are using string formatting so that they can search and find out
how it works. If your aim is to teach simple programming concepts, why
confuse them so early on with fancy interpolation?

Something like

# uses Python string formatting
# http://docs.python.org/lib/typesseq-strings.html

but really I think it will just be a distraction

rd


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


Re: Iron Python

2007-05-15 Thread BartlebyScrivener
On May 15, 5:22 am, John Machin [EMAIL PROTECTED] wrote:
   Anybody tried it?

  Me.

 Me too.

Anybody like it?

rd


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


Re: need help with python

2007-05-13 Thread BartlebyScrivener
On May 13, 10:10 am, [EMAIL PROTECTED] wrote:

 That is one of my problems, I don't know exactly how the whole command
 line thing works.

That's why I pointed you to the link. The ActiveState distribution
will automatically add the correct paths to your environment and tell
Windows that .py files are executable Python files and so on.

Get ActiveState installed. Get comfortable with the Python IDE.

Then follow the instructions in Alan Gauld's tutorial.

http://www.freenetpages.co.uk/hp/alan.gauld/

Especially, in your case, the GETTING STARTED section, which includes
a subsection called The Windows Command Prompt

rd

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


Re: GUI tutorial

2007-05-13 Thread BartlebyScrivener
On May 13, 12:51 pm, John K Masters [EMAIL PROTECTED]
wrote:
 Can someone point me in the direction of a good tutorial on programming
 python with a GUI?

Alan Gauld added a gui programming tutorial to his main course.

http://www.freenetpages.co.uk/hp/alan.gauld/

It's a frame page so I can't link directly, but select GUI
Programming under Advanced Topics on the left.

rd

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


Re: path stuff

2007-05-12 Thread BartlebyScrivener
On May 9, 1:11 pm, fscked [EMAIL PROTECTED] wrote:
 I am walking some directories looking for a certain filename pattern.
 This part works fine, but what if I want to exclude results from a
 certain directory being printed?

You might find this thread helpful

http://tinyurl.com/2guk3l

Note how the backup dirs are excluded.

Highly recommend Python Cookbook, too.

rd

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


Re: need help with python

2007-05-12 Thread BartlebyScrivener
I'm not sure how you installed Python, or how you are using it, but I
made something last year to help Windows XP users who are brand new to
Python and can't get things to run, etc.

You might try either jumping into somewhere midway, or if you keep
having trouble, uninstall whatever you installed and start over using
this:

http://www.richarddooling.com/index.php/2006/03/14/python-on-xp-7-minutes-to-hello-world/

If that link breaks, use this:

http://tinyurl.com/w7wgp

Good luck.

rd


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


Re: preferred windows text editor?

2007-05-09 Thread BartlebyScrivener
On May 9, 1:26 pm, Looney, James B [EMAIL PROTECTED] wrote:

 I'm using Vim (http://www.vim.org/).

I too vote for VIM. I use it on both Windows XP and Debian Etch. I
can't find anything it doesn't do.

rd

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


Re: Wanted: Email Client with GUI

2007-04-18 Thread BartlebyScrivener
On Apr 18, 9:25 am, Franz Steinhaeusler [EMAIL PROTECTED]
wrote:

  What I want is a program (it doesn't have to be so sophisticated
  as thunderbird) written totally in python and using a gui
  toolkit like pyqt, pygtk, wxpyhton or tkinter.

Why reinvent the wheel? Why not use Mutt and then call any Python
script you want from within Mutt. Or use Python modules written for
Mutt.

See, e.g., http://pyropus.ca/software/

rd


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


Re: Mastering Python

2007-03-16 Thread BartlebyScrivener
On Mar 16, 8:39 am, Paul McGuire [EMAIL PROTECTED] wrote:

 Wow, are you still reading?  Quit wasting time and go download a
 Python dist and get started already!


I think you should extract that and spend twenty minutes tidying it up
and then publish it to the Python for Programmers page or make it a
downloadable .pdf.

http://wiki.python.org/moin/BeginnersGuide/Programmers

rd

 The chief contribution of Protestantism to human thought is its
  massive proof that God is a bore.

  --H.L. Mencken

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


Re: Python books?

2007-03-14 Thread BartlebyScrivener
On Mar 14, 3:50 pm, [EMAIL PROTECTED] (Aahz) wrote:

 Some people prefer shorter books -- Python for Dummies (for new
 programmers) and Python in a Nutshell (for experienced programmers) both
 try to give a thorough survey of Python while keeping the book easy to
 carry.

And other people like lots of examples and code organized around
practical projects a person might like to accomplish using Python. The
Python Cookbook 2nd edition is great for this, and Martelli et al are
great writers, as well as great programmers.

rd


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


python equivalent of bash find

2007-03-01 Thread BartlebyScrivener
I recently moved from XP to Linux, but would like to use Python
whenever possible.

line from bash script:

find ~/Mail -xdev -type f \( -mtime 0 -or -mtime 1 \) -exec cp -aPvu
{} /backup-dest \;

What modules would I use to accomplish this in Python? Or any other
Python tricks to copy or backup all files modified today?

Thank you,

rd

You can't have everything. Where would you put it?--Steven Wright

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


Re: python equivalent of bash find

2007-03-01 Thread BartlebyScrivener
 You can probably replicate that using the modules os and shutil.

Thank you both for the quick response.

rd


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


Re: python equivalent of bash find

2007-03-01 Thread BartlebyScrivener
On Mar 1, 3:58 pm, Bruno Desthuilliers
[EMAIL PROTECTED] wrote:


 MHO is that you'd better learn linux (well... Unix) tools. Reinventing
 the SquareWheel(tm) is usually not a good idea.

I agree. It's just a matter of experience and learning when to use
Unix tools and when to use Python.
The question never came up on Windows :)

Thanks,

rd

 Artificial stupidity (AS) may be defined as the attempt by computer
  scientists to create computer programs capable of causing problems
  of a type normally associated with human thought.

  --Wallace Marshal



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


Re: How can I access data from MS Access?

2007-02-06 Thread BartlebyScrivener
On Feb 5, 4:52 am, Andy Dingley [EMAIL PROTECTED] wrote:
 On 3 Feb, 15:43, [EMAIL PROTECTED] wrote:

  How to access data from MS Access?

 First of all check that the DSN is working and connects to the
 back end MDB. This might not be Python's problem.

 Secondly check whatever errors you're being returned.

Yes, and then move onto something like this:

http://www.freelance-developer.com/howto_odbcpy

rd

 Give a man a fire and keep him warm for a day. Light a man on fire
  and he will be warm for rest of his life.

  --Terry Pratchett


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


GetBoundingMetrics

2007-01-22 Thread BartlebyScrivener
Hi,

I have been moving from Windows XP to Debian Etch. Most of my
Python scripts work fine with minor modifications. However, I have a
script that launches a browser and goes to various sites using the
Python module webbrowser.open (url-goes-here)

On Debian Etch, Firefox (or IceWeasel, I guess) opens the sites, but
back in the
commandline window I get repeated messages that say:

GetBoundingMetrics (char *)

Anybody know what's causing that? I don't get it if I just launch
firefox from the commandline. Only when I use the Python module.

Thank you,

rd

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


Re: GetBoundingMetrics

2007-01-22 Thread BartlebyScrivener

BartlebyScrivener wrote:

 I don't get it if I just launch
 firefox from the commandline. Only when I use the Python module.

I spoke too soon. I do get it from the command line if firefox is not
already running. Same is true with the Python script.

Must be a Gnome or Debian thing. Sorry for the distraction.

rd

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


Re: indentation in python

2007-01-13 Thread BartlebyScrivener
lee wrote:
 Can anyone tell me the basics about indentation in python..how we
 use it in loops and constructs..etc

http://docs.python.org/tut/node5.html#SECTION00520

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


Re: What is a perl hash in python

2007-01-12 Thread BartlebyScrivener
Karyn Williams wrote:

 For future reference, why is direct use of the string module frowned upon,
 and what does one use instead ?
 

Karyn, 

http://docs.python.org/lib/node42.html

rd

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


Re: Newbie: what is a usefull IDE for Python on Windows ?

2006-12-23 Thread BartlebyScrivener

in addition to the effbot link,

search the group

http://tinyurl.com/yyuxco

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


Re: python poetry?

2006-12-20 Thread BartlebyScrivener
Michael Spencer wrote:

 I wrote the following in response to Steve Holden's limerick challenge a
 couple of years ago:
 
Thanks! I found some of these searching the clp google group.

rd

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


python poetry?

2006-12-19 Thread BartlebyScrivener
I'm working on a book of technology and computer programming humor.

First, can anybody recommend any other such books? And second is there
a repository of Python poetry, poems translated into Python, or
humorous Python pseudo code limericks anywhere?  I'm making my way
through The Larch, but if there's more elsewhere please point me to
it.

I'm looking for the Python equivalent of something like this:

http://www.heavyflash.com/poetry/Shakespeare_Sonnet18.html

Thank you all

rd 
http://dooling.com

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


Re: python poetry?

2006-12-19 Thread BartlebyScrivener

Bruno Desthuilliers wrote:
 You of course already know . . . and BOFH (aka the
 Bastard Operator From Hell') ?

Didn't know this one. It's funny!

Thanks

rd

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


Re: How do I edit a PythonWin path to import custom built modules???

2006-12-14 Thread BartlebyScrivener
Fredrik Lundh wrote:

 is this an ActiveState build?

Yes, I think I mentioned it further up the thread.

 what's sys.prefix and sys.exec_prefix set to on your machine, btw?

'C:\\Python24'

No big deal. I always just assumed that it found my scripts via the
path variable. As long as it finds them. I'm happy.

But you got me thinking. I just did the commands you suggested on my
laptop, after installing python.org 2.5. With 'd:\python' in the path
environmental variable there also, it does NOT appear when I do plain
old:

sys.path

but does appear when I import site first.

rd

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


Re: How do I edit a PythonWin path to import custom built modules???

2006-12-14 Thread BartlebyScrivener
Fredrik Lundh wrote:

 have you searched the *entire* registry for the PythonCore key?
 (python looks under HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER)


I found it in the Scripts key! I was searching on PythonPath before.
Sorry. Thank you for the enlightenment.

rd

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


Re: How do I edit a PythonWin path to import custom built modules???

2006-12-13 Thread BartlebyScrivener

Fredrik Lundh wrote:

 Python does *not* use the Path when searching for modules; sys.path is
 initialized based on the contents of PYTHONPATH, the location of the
 Python executable (or PYTHONHOME), some heuristics, and certain registry
 entries.

Now I'm stumped. Unless it's heuristics. The registry entry for
PythonPath does NOT reference the location of my Python scripts
(d:/Python). And Python is installed in the usual place on C:\Python24.
The only place that I can see where I've told it the location of my
scripts is in the Path variable.

I have no doubt that you're correct. Just confused as usual.

rd

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


Re: How do I edit a PythonWin path to import custom built modules???

2006-12-13 Thread BartlebyScrivener

Gabriel Genellina wrote:

 import sys
 print sys.path
 and see what's there.

Yup. Did that before. That's what I mean. The d:\\python is there and
it doesn't come from the PythonPath in my windows registry. Maybe it
scans for any directory with python in the name?

['', 'C:\\WINDOWS\\system32\\python24.zip', 'd:\\python',
'C:\\Python24\\DLLs', 'C:\\Python24\\lib',
'C:\\Python24\\lib\\plat-win', 'C:\\Python24\\lib\\lib-tk',
'C:\\Python24\\Lib\\site-packages\\pythonwin', 'C:\\Python24',
'C:\\Python24\\lib\\site-packages',
'C:\\Python24\\lib\\site-packages\\win32',
'C:\\Python24\\lib\\site-packages\\win32\\lib',
'C:\\Python24\\lib\\site-packages\\wx-2.7.1-msw-ansi']

rd

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


Re: How do I edit a PythonWin path to import custom built modules???

2006-12-13 Thread BartlebyScrivener
Fredrik Lundh wrote:

 what do you get if you do:

  python -S
 ...
 import sys
 sys.path

['', 'C:\\WINDOWS\\system32\\python24.zip', 'd:\\python',
'C:\\Python24\\DLLs', 'C:\\Python24\\lib',
'C:\\Python24\\lib\\plat-win', 'C:\\Python24\\lib\\lib-tk', 'C:\
\Python24']

 and then

 import site
 sys.path

['d:\\python', 'C:\\WINDOWS\\system32\\python24.zip',
'C:\\Python24\\DLLs', 'C:\\Python24\\lib',
'C:\\Python24\\lib\\plat-win', 'C:\\Python24\\lib\\lib-tk', 'C:\\Pyt
hon24', 'C:\\Python24\\lib\\site-packages',
'C:\\Python24\\lib\\site-packages\\win32',
'C:\\Python24\\lib\\site-packages\\win32\\lib',
'C:\\Python24\\lib\\site-packa
ges\\Pythonwin', 'C:\\Python24\\lib\\site-packages\\wx-2.7.1-msw-ansi']

rd

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


Re: How do I edit a PythonWin path to import custom built modules???

2006-12-13 Thread BartlebyScrivener
jay graves wrote:
 
 Do you have any *.pth files in the C:\Python24 directory?
 

No.

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


Re: How do I edit a PythonWin path to import custom built modules???

2006-12-12 Thread BartlebyScrivener

Gabriel Genellina wrote:

 There was an error in a previous post, you should create a variable
 called PYTHONPATH, not change the system PATH.
 Or, group your modules into packages and put them below
 lib\site-packages.


Perhaps your way works also, but I have no PythonPath defined in system
variables on Windows XP.

I keep my Python scripts and modules in d:\Python. I added d:\Python to
the Path variable and I can call and import the scripts and modules
from anywhere I please.

I'm pretty sure that the ActiveState distribution of Python adds its
paths to the Path variable also.

rd

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


Re: How do I edit a PythonWin path to import custom built modules???

2006-12-11 Thread BartlebyScrivener
mohan wrote:

 I had created my own modules (.py files) in
 drives and folders other than the python root.

Probably easiest if you keep them all in one place. Then add that
place to your path by going into Control
Panel|System|Advanced|Environment Variables and adding the path to the
path variable.

Hope that helps.

rd

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


Re: Active State and Komodo...

2006-11-24 Thread BartlebyScrivener
Steve Thompson wrote:

 I was wondering the differnced there were betwee Active State's python and
 the open source version of python.

The biggest difference at the moment is that ActiveState is still using
Python 2.4.3 in their distribution. They should be coming out with 2.5
soon.

Sounds like you are running Suse?  So you already have some version of
Python, right? You can search this group at comp.lang.python on Google
Groups--try python versions linux--or something like that--but the
issue you need to watch out for is running two different versions on
Linux.

Long and short, you don't want to uninstall the version of Python that
came with your Suse, because other programs on your machine probably
use that particular version. It's easy to install an ADDITIONAL
distribution of Python and run it separately, but again. Search the
list
for how to do that, and how to run them separately once you do.

I'm just moving to Linux myself, so can't provide the expertise. Unless
there is some killer feature of 2.5 you need, I would just use the
Python that came with your Suse.

rd

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


Re: Active State and Komodo...

2006-11-24 Thread BartlebyScrivener
Steve Thompson wrote:
 On Fri, 24 Nov 2006 06:35:21 -0500, Steve Thompson wrote:

  Addionally, is the eric IDE (version 3) an acceptible IDE or are there
  more easy and more productive IDE's for perl?

Perl? You're on a Python list?  Anyway, the subject of IDEs comes up
every other day. If you want comparisons or discussion of Eric and
Python, search the group for Eric IDE

http://groups.google.com/group/comp.lang.python/search?q=eric+idestart=0scoring=d;

If the link breaks, use:

http://tinyurl.com/yxy8vv

I use vim 7.0 and Komodo myself. Both are cross platform. You'll see
hundreds of different opinions here.

rd

A couple of months in the laboratory can save a couple of hours in the
library.

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


Re: synching with os.walk()

2006-11-24 Thread BartlebyScrivener
Antoine De Groote wrote:

 http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/191017
 might be what you are looking for, or at least a starting point...


There's an updated version of this script at pages 403-04 of the Python
Cookbook 2nd Edition.

rd

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


Re: Caution newbie question: python window to stay open ?

2006-11-21 Thread BartlebyScrivener
mkengel wrote:

 Caution: newbie question

If you're pretty sure it's a common newbie question, then begin by
going to the Google repository at:

http://groups.google.com/group/comp.lang.python

Search in the box at upper right, on, say, keep cmd window open, or
keep dos window open.

Like so:

http://tinyurl.com/yfbtgx

And you'll have answers going all the way back to antiquity.

rd

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


Re: How do I stop Python IDLE (GUI) from immediately exiting when I enter it?

2006-11-19 Thread BartlebyScrivener
John (Z R) L wrote:

 But after clicking run module

Being new is never problem, but do learn to provide concise, complete
descriptions of exactly what happened and what you were doing at the
time.

Are you in IDLE? Or are you in PythonWin?  OR did you make a script
file and try to run it by double clicking on it?

Sounds like you were creating a script file, then tried to run it?
Search this list at Google Groups comp.lang.python for keep DOS box
open.

http://tinyurl.com/wh7fy

 Another problem I have is firewall. On my old computer (Windows 98)
 when using Python GUI, it can't run modules because of some firewall.

Please enter the exact error message you get. It's probably some
officious Windows security glitch, but nobody can help you until you
provide the messages you get.

Windows 98? Linux would run twice as fast on any machine old enough to
run Windows 98, and your Python would work better, too. 

Good luck,

rd

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


Re: another newbie question

2006-11-14 Thread BartlebyScrivener
Lots of smart, patient people here, but they can't help you until you
provide a lot more information and the actual error messages you are
getting and whether they are spawned by Python or MySQL, if that is
indeed the db you are using. Where did you get the idea that Python
might be involved?

Read this and it will serve you well for this inquiry and any others
you may have.

http://catb.org/esr/faqs/smart-questions.html

Good luck

rd

Give a man a fire and keep him warm for a day. Light a man on fire
 and he will be warm for rest of his life. --Terry Pratchett

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


Re: Pyro stability

2006-11-08 Thread BartlebyScrivener
Some guy hit my fender, and I said to him, 'Be fruitful and multiply,'
but not in those words. --Woody Allen

Language is a virus from outer space. --William Burroughs

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


Re: profanity on comp.lang.python (was Re: Pyro stability)

2006-11-08 Thread BartlebyScrivener

[EMAIL PROTECTED] wrote:

 I'm with Beliavsky on this one.  I can't see any particular reason to curse
 in a forum such as c.l.py.  It just coarsens the discussion with no obvious
 positive benefit as far as I can see.

All true. But it's like picking your nose. Yes, it's bad manners in
public, but if somebody does it, why jump on it and call attention to
it? It just makes the thread three times longer. It's easier and more
efficient to just ignore it.

I say this after posting three messages on the topic :)

rd

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


Re: Python to tell what is the IP of my PC .

2006-11-08 Thread BartlebyScrivener

NicolasG wrote:
 How can I use python to get the real IP address of my DSL router

http://whatismyip.com

rd

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


Re: sqlite query not working

2006-11-07 Thread BartlebyScrivener

John Salerno wrote:

 Ah well, I'm sure there was *something* different

Are you sure that it's not you were doing SELECT before, as opposed to
INSERT?

rd

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


  1   2   3   4   >