Re: Question on Python 3 shell restarting

2012-04-09 Thread Albert W. Hopkins
On Sun, 2012-04-08 at 20:09 +0200, Franck Ditter wrote:
> How may I get a fresh Python shell with Idle 3.2 ?
> I have to run the same modules several times with all
> variables cleared.

Why don't you write your module as a script and pass the variables via
command line like most human beings?


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


Re: "convert" string to bytes without changing data (encoding)

2012-03-28 Thread Albert W. Hopkins
On Wed, 2012-03-28 at 14:05 -0400, Ross Ridge wrote:
> Ross Ridge  wr=
> > Of course it is. =A0Conceptually you're not supposed to think of it that
> > way, but a string is stored in memory as a series of bytes.
> 
> Chris Angelico   wrote:
> >Note that distinction. I said that a string "is not" a series of
> >bytes; you say that it "is stored" as bytes.
> 
> The distinction is meaningless.  I'm not going argue with you about what
> you or I ment by the word "is".
> 

Off topic, but obligatory:

https://www.youtube.com/watch?v=j4XT-l-_3y0


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


Re: MySQL: AttributeError: cursor

2012-02-11 Thread Albert W. Hopkins
On Sat, 2012-02-11 at 09:40 -0800, Kevin Murphy wrote:
> Hi All,
> I'm using Python 2.7 and having a problem creating the cursor below.
> Any suggestions would be appreciated!
> 
> import sys
> import _mysql
> 
> print "cursor test"
> 
> db =
> _mysql.connect(host="localhost",user="root",passwd="mypw",db="python-
> test")
> 
> cursor = db.cursor()
> 
> >>>
> cursor test
> 
> Traceback (most recent call last):
> File "C:\Python27\dbconnect.py", line 8, in 
> cursor = db.cursor()
> AttributeError: cursor

You are using the low-level C API wrapper (not sure why).  Most people,
I believe, would use the pythonic API:

>>> import MySQLdb
>>> db = MySQLdb.connect(host='localhost', user='root', passwd='mypw',
db='python-test')
>>> cursor = db.cursor()

The low-level API is... well.. for when you want to do low-level stuff.
You probably want the pythonic API.

-a


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


Re: Fabric Engine + Python benchmarks

2012-02-10 Thread Albert W. Hopkins
On Fri, 2012-02-10 at 14:52 -0800, Paul Rubin wrote:
> Fabric Paul  writes:
> > Hi Stefan - Thanks for the heads up. Fabric Engine has been going for
> > about 2 years now. Registered company etc. I'll be sure to refer to it
> > as Fabric Engine so there's no confusion. We were unaware there was a
> > python tool called Fabric.
> 
> There will still be confusion.  The Fabric configuration tool is quite
> well known in the python and sysadmin communities, so it will be the
> first thing people will think of.  If you weren't already aware of it,
> I'd guess you're pretty far out of contact with Python's existing user
> population, so there may be further sources of mismatch between your
> product and what else is out there (I'm thinking of Stackless, PyPy,
> etc.)  Still, yoour product sounds pretty cool.
> 

Indeed.  When I first saw the subject header I thought it was referring
to the Python-based deployment tool.  It's just going to confuse people.
It's enough already that we have a bunch of stuff with "pi" and "py" in
the name :|

Does the OSS community *really* need another "Firebird" incident?

-a


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


Re: Installing Python on CentOS 6 - a big pain

2012-01-18 Thread Albert W. Hopkins
On Wed, 2012-01-18 at 10:00 -0800, John Nagle wrote:
> Python does not "just work".  I should be able to command
> "yum install python27".  (And not clobber the Python 2.6 that
> comes with CentOS.)
> 
> This sort of thing is why Python is losing market share.
> 
> 
Or — and this is the more likely scenario — it could be that this has
nothing to do with the Python language per sé and you are just playing
the whiny snot-nosed kid.


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


Re: sick of distribute, setup, and all the rest...

2011-11-26 Thread Albert W. Hopkins
On Sat, 2011-11-26 at 14:22 +, Steven D'Aprano wrote:
> > when is python going to get a decent module distribution system???
> 
> Python 4.3, scheduled for March 2038. It's been ready for a few years 
> now, and a small secret coterie of privileged developers have been
> using 
> it for their own in-house projects since version 2.1, but it was
> decided 
> not to release it to the general public, because they'll just bitch
> and 
> moan that it's a disgrace without actually explaining why they think
> so, 
> or volunteering to help build a better system.
> 
> 
I suspected that all along!
> 
> 

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


Re: Stop quoting spam [was Re: Hot Girls ...]

2011-08-19 Thread Albert W. Hopkins


On Friday, August 19 at 17:12 (-0400), Matty Sarro said:

> 
> If you're that offended then spend the cycles fixing the damn list so
> it
> stops having so much spam. You realize spam comes in almost
> constantly,
> right? Enough that multiple tines over the past weeks there have been
> no
> less than 3 threads about it.

For me, the original post ended in my spam box, which means my filter is
doing it's job, but when you re-post it, my filter did not regard it as
spam.  I actually wish it had.  Therefore you are an enabler.


> If php, red hat, and perl can manage it for their lists, why not
> python? Is
> that a statement about python programmers?
> 

The python list is (also) a Usenet newsgroup.  Usenet is distributed and
therefore there is no central place to filter spam (each usenet host
would have to have its own filter and what one considers spam another
might consider ham)... anyway, that's neither here nor there.  Having my
own filter usually works.

I'm not here to dis you, just to try to help you understand the how/why
regarding the re-post and why your attitude about it might give the
impression of apathy toward your peer community.




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


Re: Python script error when using print

2010-04-06 Thread Albert W. Hopkins
On Tue, 2010-04-06 at 08:38 -0700, Robbie wrote:
> Hi all,
> 
> So, I'm trying to use Python with an apache2 server to create some web
> pages.  The web server is configured and seems to work correctly, but
> only with a certain type of script.
> 
> For instance, this script works fine
> 
> #!/usr/bin/env python
> def index():
> s = "Hello World"
> return s
> 
> But, a script like this, does not.
> #!/usr/bin/env python
> print "hello world"
> 
> When I try to use the script with print, the server returns a broken
> link error.  There is nothing in the apache error log to help me
> understand why it won't work.

Is this a CGI script?  You need to return headers (like Content-type):

e.g. (untested)

print "Content-type: text/plain"
print
print "hello world"

See also
http://docs.python.org/library/cgi.html

-a


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