split string into multi-character "letters"

2010-08-25 Thread Jed
Hi, I'm seeking help with a fairly simple string processing task.
I've simplified what I'm actually doing into a hypothetical
equivalent.
Suppose I want to take a word in Spanish, and divide it into
individual letters.  The problem is that there are a few 2-character
combinations that are considered single letters in Spanish - for
example 'ch', 'll', 'rr'.
Suppose I have:

alphabet = ['a','b','c','ch','d','u','r','rr','o'] #this would include
the whole alphabet but I shortened it here
theword = 'churro'

I would like to split the string 'churro' into a list containing:

'ch','u','rr','o'

So at each letter I want to look ahead and see if it can be combined
with the next letter to make a single 'letter' of the Spanish
alphabet.  I think this could be done with a regular expression
passing the list called "alphabet" to re.match() for example, but I'm
not sure how to use the contents of a whole list as a search string in
a regular expression, or if it's even possible.  My real application
is a bit more complex than the Spanish alphabet so I'm looking for a
fairly general solution.
Thanks,
Jed
-- 
http://mail.python.org/mailman/listinfo/python-list


Problem running Python 3.5.2 on school network PC

2016-12-15 Thread Jed Mack
We are having a problem running Python 3.5.2 on Windows 10 x64 computers,
which are members of a school network.



The program seems to install correctly, but when we try to run the program
it stops and give an error message saying:



*Fatal Python error: Py_Initialize: unable to load the file system codec*

*Traceback (most recent call last):*

*  File "C:\Program Files\Python35\lib\encodings\__init__.py", line 31, in<
module>*

*zipimport.ZipImportError: can't find module 'codecs'*





On a Windows 7 PCs, on the same network, the program runs with no problems.



We have no one here who is familiar with Python.  Do you have any
additional information on this error, and suggestions for fixing it?



We have a teacher who needs this program on Windows 10 PCs for students to
use beginning January 3.



Thanks,

Jed Mack
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Problem running Python 3.5.2 on school network PC

2016-12-19 Thread Jed Mack
This problem has been solved.  Thanks to all of you for your suggestions.
Below is a summary I sent to Tim Golden, whose reply led us to the solution
in this case.

Tim,

Thank you for your help  -  your suggestions led us to the problem.  Turns
out that another instance of Python *was* installed, not as part of OEM
software, but by a digital camera (Califone) that is being used in some of
our classrooms.  The suggestion to look for environmental variables was the
key  -  on the PCs where we were having the problem, there was a variable
starting with PYTHON ... which pointed to the camera software.  Once the
camera was uninstalled, Python 3.5.2 worked just fine.

Thanks again!

On Thu, Dec 15, 2016 at 11:11 AM, Jed Mack  wrote:

> We are having a problem running Python 3.5.2 on Windows 10 x64 computers,
> which are members of a school network.
>
>
>
> The program seems to install correctly, but when we try to run the program
> it stops and give an error message saying:
>
>
>
> *Fatal Python error: Py_Initialize: unable to load the file system codec*
>
> *Traceback (most recent call last):*
>
> *  File "C:\Program Files\Python35\lib\encodings\__init__.py", line 31,
> in< module>*
>
> *zipimport.ZipImportError: can't find module 'codecs'*
>
>
>
>
>
> On a Windows 7 PCs, on the same network, the program runs with no problems.
>
>
>
> We have no one here who is familiar with Python.  Do you have any
> additional information on this error, and suggestions for fixing it?
>
>
>
> We have a teacher who needs this program on Windows 10 PCs for students to
> use beginning January 3.
>
>
>
> Thanks,
>
> Jed Mack
>
>
>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Fwd: I am giving up perl because of assholes on clpm -- switching to Python

2007-07-26 Thread jed drury
Hey, Perl's new motto is "There is more than 1 way to
be an ASSHOLE!"


  

Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel 
and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 

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


ldap usage

2006-03-28 Thread Jed Parsons

Hi,

  authenticates a user against our ldap server.: User types in name and 
password, and module sees if name and password check out right with the 
ldap server.

I see that it's pretty straightforward to do this with:

 import ldap
 l = ldap.open('our.ldap.server')
 try:
 l.bind_s(username, password, ldap.AUTH_SIMPLE)
 authenticated = True
 except:
authenticated = False

But this uses the plaintext of the user's password.  Is there a proper 
way to send a cryptographic hash to the ldap server?  Or do I have to 
negotiate this through an ssl tunnel or something?

Thanks for any tips.  Cheers!
j

-- 
Jed Parsons   Industrial Light + Magic  (415) 746-2974

grep(do{for(ord){(!$_&&print"$s\n")||(($O+=(($_-1)%6+1)and
grep(vec($s,$O++,1)=1,1..int(($_-6*6-1)/6}},(split(//,
"++,++2-27,280,481=1-7.1++2,800+++2,8310/1+4131+1++2,80\0.  What!?")));
-- 
http://mail.python.org/mailman/listinfo/python-list


RE: ldap usage

2006-03-28 Thread Jed Parsons
Title: RE: ldap usage







Looks like the top of my message got garbled

I was trying to say that I'm using ldap for the first time,
trying to write a script that authenticates a user against
our ldap server.  etc.  The rest came through.

Hope that makes more sense now :)

j

-Original Message-
From: [EMAIL PROTECTED] on behalf of Jed Parsons
Sent: Tue 3/28/2006 5:55 PM
To: python-list@python.org
Subject: ldap usage


Hi,

  authenticates a user against our ldap server.: User types in name and
password, and module sees if name and password check out right with the
ldap server.

I see that it's pretty straightforward to do this with:

 import ldap
 l = ldap.open('our.ldap.server')
 try:
 l.bind_s(username, password, ldap.AUTH_SIMPLE)
 authenticated = True
 except:
    authenticated = False

But this uses the plaintext of the user's password.  Is there a proper
way to send a cryptographic hash to the ldap server?  Or do I have to
negotiate this through an ssl tunnel or something?

Thanks for any tips.  Cheers!
j

--
Jed Parsons   Industrial Light + Magic  (415) 746-2974
   
grep(do{for(ord){(!$_&&print"$s\n")||(($O+=(($_-1)%6+1)and
grep(vec($s,$O++,1)=1,1..int(($_-6*6-1)/6}},(split(//,
"++,++2-27,280,481=1-7.1++2,800+++2,8310/1+4131+1++2,80\0.  What!?")));
--
http://mail.python.org/mailman/listinfo/python-list






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

Re: ldap usage

2006-03-29 Thread Jed Parsons

Hi, Michael,

Thanks very much for your response.  I think I can work it out now.

 >> authenticated = False
 >   ^^^
 > Identiation is wrong here.

Yes, sorry about that - doesn't always work on this email client :(

As an addendum, I discovered one little gotcha, namely that this:

l.bind_s(username, password, ldap.AUTH_SIMPLE)

throws an ldap.INVALID_CREDENTIALS error if the password contains the 
wrong text, but works if the password is empty.  I guess this is 
tantamount to binding as ("", ""), but I wasn't expecting it; I figured 
if a username was specified, the password would have to agree.  So my 
little authentication example also needs to test for empty passwords.

Neither here nor there, really; just thought I'd mention it since I ran 
into it.

Now I'm off to check out the Demo/*.py scripts you pointed me to.

Thanks again.  Cheers!
j

Michael Ströder wrote:
> Jed Parsons wrote:
>> import ldap
>> l = ldap.open('our.ldap.server')
>> try:
>> l.bind_s(username, password, ldap.AUTH_SIMPLE)
>> authenticated = True
>> except:
>> authenticated = False
>   ^^^
> Identiation is wrong here.
> 
> Also I'd recommend to catch the ldap.LDAPError exceptions more
> specifically (ldap.INVALID_CREDENTIALS indicates wrong password):
> 
>  try:
>  l.bind_s(username, password, ldap.AUTH_SIMPLE)
>  except ldap.INVALID_CREDENTIALS:
>  authenticated = False
>  else:
>  authenticated = True
> 
>> But this uses the plaintext of the user's password.
> 
> Yes, since this is a LDAP Simple Bind Request as defined in RFC 2251.
> 
>>  Is there a proper
>> way to send a cryptographic hash to the ldap server?  Or do I have to
>> negotiate this through an ssl tunnel or something?
> 
> SSL (either LDAPS or StartTLS extended operation) is one possibility to
> secure the whole connection including bind requests (see
> Demo/initialize.py).
> 
> Another option is to use SASL with DIGEST-MD5 if your server supports it
> (see Demo/sasl_bind.py) and has the cleartext passwords available. Other
> options with SASL, e.g. GSSAPI (Kerberos), exist but highly depends on
> your IT infrastructure and LDAP server configuration.
> 
> Just follow-up here or on the python-ldap-dev mailing list if you have
> further problems.
> 
> Ciao, Michael.

-- 
Jed Parsons   Industrial Light + Magic  (415) 746-2974

grep(do{for(ord){(!$_&&print"$s\n")||(($O+=(($_-1)%6+1)and
grep(vec($s,$O++,1)=1,1..int(($_-6*6-1)/6}},(split(//,
"++,++2-27,280,481=1-7.1++2,800+++2,8310/1+4131+1++2,80\0.  What!?")));

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


Re: ldap usage

2006-03-30 Thread Jed Parsons

 > Which LDAP server are you using? You can switch off this behaviour
 > with OpenLDAP. See man 5 slapd.conf, allow .

I don't have anything other than user access.  Good to know about this 
feature, though.

You've been very helpful - I really appreciate it.

Can you recommend any favorite books or sites where I can learn more 
about ldap?

Many thanks,
j

Michael Ströder wrote:
> Jed Parsons wrote:
>> As an addendum, I discovered one little gotcha, namely that this:
>>
>> l.bind_s(username, password, ldap.AUTH_SIMPLE)
>>
>> throws an ldap.INVALID_CREDENTIALS error if the password contains the
>> wrong text, but works if the password is empty.  I guess this is
>> tantamount to binding as ("", ""), but I wasn't expecting it; I figured
>> if a username was specified, the password would have to agree.
> 
> Yes, this is by design. Empty cred means just switching to anon
> bind. LDAP was not intended to be used for password checking at that time.
> 
> Which LDAP server are you using? You can switch off this behaviour with
> OpenLDAP. See man 5 slapd.conf, allow .
> 
>>  So my
>> little authentication example also needs to test for empty passwords.
> 
> Yes!
> 
> Ciao, Michael.

-- 
Jed Parsons   Industrial Light + Magic  (415) 746-2974

grep(do{for(ord){(!$_&&print"$s\n")||(($O+=(($_-1)%6+1)and
grep(vec($s,$O++,1)=1,1..int(($_-6*6-1)/6}},(split(//,
"++,++2-27,280,481=1-7.1++2,800+++2,8310/1+4131+1++2,80\0.  What!?")));

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


logging producing redundant entries

2006-03-30 Thread Jed Parsons

Hi,

I'm using the logging module for the first time.  I'm using it from 
within Zope Extensions.

My problem is that, for every event logged, the logger is producing 
multiple identical entries with the timestamp the same down to the 
millisecond.

Is this something I'm doing wrong?

Log snippet:

2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
2006-03-30 16:20:14,173 INFO: Login: Jed Parsons

I would like only one of the above lines in my log file; not all those 
copies.

I'm using this simple logging setup at the top of a zope Extension module:

 import logging
 # basicConfig for python 2.3
 logging.basicConfig()
 _logger = logging.getLogger("login")
 _logger.setLevel(logging.DEBUG)
 _handler = logging.FileHandler(LOG_ROOT, 'login.log'))
 _formatter = logging.Formatter("%(asctime)s %(levelname)s: 
%(message)s")
 _handler.setFormatter(_formatter)
 _logger.addHandler(_handler)

So these are global to the module.  The log lines above were produced by 
what I expected would be a single call to _logger.info() in a function 
in the module:

 _logger.info("Login: %s %s" % (firstname, lastname))

Can anyone explain what I'm doing wrong?  Many thanks,
j


-- 
Jed Parsons   Industrial Light + Magic  (415) 746-2974

grep(do{for(ord){(!$_&&print"$s\n")||(($O+=(($_-1)%6+1)and
grep(vec($s,$O++,1)=1,1..int(($_-6*6-1)/6}},(split(//,
"++,++2-27,280,481=1-7.1++2,800+++2,8310/1+4131+1++2,80\0.  What!?")));
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: logging producing redundant entries

2006-03-31 Thread Jed Parsons

Thanks, Peter and alex23,

The metalog test shows that the code is only being executed once at a time.

And if I take those lines and put them in a shell script (fixing the 
FileHandler - sorry about the bad copy there), they work as expected, 
producing a single log entry.

So I'm left with:

- logging code that works properly in isolation in a shell script
- zope extension code that gets called only once (metalog test)
- logging code produces multiple entries when executed in extension
- logging code seems to produce more and more entries over time

Am I somehow accumulating a growing list of loggers by having this code 
at the top of a zope Extension?  If I cause the extension to be 
re-evaluated, do I somehow attach another logger?  (I'm grasping at 
straws...)

I've tried the following to only call getLogger once, but it doesn't 
seem to help:

try:
 _logger
except NameError:
 _logger = logging.getLogger('login')
 etc...

Thanks again for any suggestions.  I'm pretty well baffled.
j

Peter Otten wrote:
> Jed Parsons wrote:
> 
>> I'm using the logging module for the first time.  I'm using it from
>> within Zope Extensions.
>>
>> My problem is that, for every event logged, the logger is producing
>> multiple identical entries with the timestamp the same down to the
>> millisecond.
>>
>> Is this something I'm doing wrong?
>>
>> Log snippet:
>>
>> 2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
>> 2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
>> 2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
>> 2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
>> 2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
>> 2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
>> 2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
>> 2006-03-30 16:20:14,173 INFO: Login: Jed Parsons
>>
>> I would like only one of the above lines in my log file; not all those
>> copies.
>>
>> I'm using this simple logging setup at the top of a zope Extension module:
>>
>>  import logging
>>  # basicConfig for python 2.3
>>  logging.basicConfig()
>>  _logger = logging.getLogger("login")
>>  _logger.setLevel(logging.DEBUG)
>>  _handler = logging.FileHandler(LOG_ROOT, 'login.log'))
>>  _formatter = logging.Formatter("%(asctime)s %(levelname)s:
>> %(message)s")
>>  _handler.setFormatter(_formatter)
>>  _logger.addHandler(_handler)
>>
>> So these are global to the module.  The log lines above were produced by
>> what I expected would be a single call to _logger.info() in a function
>> in the module:
>>
>>  _logger.info("Login: %s %s" % (firstname, lastname))
>>
>> Can anyone explain what I'm doing wrong?  Many thanks,
> 
> Please cut and paste -- the FileHandler arguments are wrong and there is an
> extra ')'. As alex23 said, basicConfig() adds a handler, but that logs to
> stderr by default. You seem to be executing the code given above multiple
> times. You can verify that by prepending your snippet with
> 
> f = open("metalog.txt", "a")
> f.write("configuring handler\n")
> f.close()
> 
> If metalog.txt contains multiple lines after your program has terminated
> (you may have to shut down Zope -- don't know about that), a quick fix
> might be
> 
> import logging
> if not logging.root.handlers:
> # your setup code
> 
> Peter

-- 
Jed Parsons   Industrial Light + Magic  (415) 746-2974

grep(do{for(ord){(!$_&&print"$s\n")||(($O+=(($_-1)%6+1)and
grep(vec($s,$O++,1)=1,1..int(($_-6*6-1)/6}},(split(//,
"++,++2-27,280,481=1-7.1++2,800+++2,8310/1+4131+1++2,80\0.  What!?")));
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: logging producing redundant entries

2006-03-31 Thread Jed Parsons


Thanks, Kent and Peter,

Definitely making progress here.  I've got propagate = 0, and am testing 
for handlers before doing any addHandler business.  (The handlers test 
seems to make the most difference.)

I'm down to two entries per time now!  And prodding Zope to reload the 
module doesn't cause the number to increase.

It's a good thing for Zope to reload modules when you touch them, but I 
didn't anticipate that this would be a side-effect.

Thanks again for your help.  Cheers,
j

Kent Johnson wrote:
> Jed Parsons wrote:
>> Thanks, Peter and alex23,
>>
>> The metalog test shows that the code is only being executed once at a time.
>>
>> And if I take those lines and put them in a shell script (fixing the 
>> FileHandler - sorry about the bad copy there), they work as expected, 
>> producing a single log entry.
>>
>> So I'm left with:
>>
>> - logging code that works properly in isolation in a shell script
>> - zope extension code that gets called only once (metalog test)
>> - logging code produces multiple entries when executed in extension
>> - logging code seems to produce more and more entries over time
>>
>> Am I somehow accumulating a growing list of loggers by having this code 
>> at the top of a zope Extension?  If I cause the extension to be 
>> re-evaluated, do I somehow attach another logger?  (I'm grasping at 
>> straws...)
> 
> It sounds like Zope is reloading your extension. Each time it is 
> reloaded you will attach another logger.
>> I've tried the following to only call getLogger once, but it doesn't 
>> seem to help:
>>
>> try:
>>  _logger
>> except NameError:
>>  _logger = logging.getLogger('login')
>>  etc...
> 
> No, that won't work if it really is a reload, _logger will never be 
> defined. Can you put the logging setup somewhere else, in a module that 
> is only loaded once? Or inspect _logger.handlers to see if it already 
> contains a FileHandler to your log file, and only add it if it is not 
> there already.
> 
> Kent

-- 
Jed Parsons   Industrial Light + Magic  (415) 746-2974

grep(do{for(ord){(!$_&&print"$s\n")||(($O+=(($_-1)%6+1)and
grep(vec($s,$O++,1)=1,1..int(($_-6*6-1)/6}},(split(//,
"++,++2-27,280,481=1-7.1++2,800+++2,8310/1+4131+1++2,80\0.  What!?")));
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] [Python-Dev] Inclusive Range

2010-10-08 Thread Jed Smith
On Fri, Oct 8, 2010 at 1:26 PM, Steven D'Aprano
 wrote:
> On Fri, 08 Oct 2010 10:21:16 +0200, Antoon Pardon wrote:
>
>> Personnaly I find it horrible
>> that in the following expression: L[a:b:-1], it is impossible to give a
>> numeric value to b, that will include L[0] into the reversed slice.
>
>
>
>>>> L = [1, 2, 3, 4, 5]
>>>> L[5:-6:-1]
> [5, 4, 3, 2, 1]

>>> a = [1, 2, 3, 4, 5, 6]
>>> a[::-1]
[6, 5, 4, 3, 2, 1]

-- 
Jed Smith
j...@jedsmith.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can't find pythonwin

2010-10-10 Thread Jed Smith
On Sun, Oct 10, 2010 at 8:24 PM, HP Garcia  wrote:
> I am working on a class project that requires us to use python. I have never
> used python before so be gentle. My question is I have python 2.5 installed
> on my pc. The instructions as me to run pythonwin but I can't find
> pythonwin. What I did find is IDLE(GUI). Any suggestions where I can find
> it. I did a search on m pc and no luck.

As far as I know, Pythonwin is a collection of extensions to Python
that are available on Windows (and antiquated).

If your professor means "Python on Windows" instead of "Pythonwin",
this might be of use:
http://docs.python.org/faq/windows#how-do-i-run-a-python-program-under-windows

-- 
Jed Smith
j...@jedsmith.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Missing modules for python

2010-10-11 Thread Jed Smith
On Mon, Oct 11, 2010 at 8:43 AM, Sunil Saggar  wrote:
> I was trying to make exe from python program and found the following errors
>
> The following modules appear to be missing
> ['email.FeedParser', 'email.Generator', 'email.Iterators', 'email.Message',
> 'email.Utils', 'simplejson', 'socks']
>
> I am using Python  2.6

simplejson got merged into the standard library in Python 2.6. In
libcloud, I wrote this:

  try: import json
  except ImportError, excp: import simplejson as json

Is your app looking for simplejson? (I didn't look in to the other modules.)

-- 
Jed Smith
j...@jedsmith.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Can't find pythonwin

2010-10-11 Thread Jed Smith
On Mon, Oct 11, 2010 at 3:46 AM, Dennis Lee Bieber
 wrote:
> On Sun, 10 Oct 2010 20:33:09 -0400, Jed Smith 
> declaimed the following in gmane.comp.python.general:
>
>>
>> As far as I know, Pythonwin is a collection of extensions to Python
>> that are available on Windows (and antiquated).
>>
>        Really... Does this mean ActiveState no longer distributes the
> PythonWin IDE (along with the win32 extensions) in their Windows builds?

Take what I said with a grain of salt. I don't develop on Windows, and
glanced rapidly at Mark's page on starship which has a section of
"older releases" that looked like current ones at a quick glance.

Then he replied in this thread (and I found the SourceForge page), and
I *really* felt like a moron.

If you pretend my message isn't there, I'll owe you a beer.

-- 
Jed Smith
j...@jedsmith.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Standardizing RPython - it's time.

2010-10-11 Thread Jed Smith
On Mon, Oct 11, 2010 at 4:01 PM, John Nagle  wrote:

> file:///C:/Users/nagle/AppData/Local/Temp/shedskin-tutorial-0.3.html

This gives me a 404. Your Web server is broken! Fix it! ;)

Temporarily mirrored: http://jedsmith.org/tmp/shedskin-tutorial-0.5.html

-- 
Jed Smith
j...@jedsmith.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python deadlocks when Popen in multithread.

2010-10-11 Thread Jed Smith
On Mon, Oct 11, 2010 at 4:19 PM, INADA Naoki  wrote:

> def worker():
>    p = Popen(["cat"], stdin=PIPE, stdout=PIPE, stderr=STDOUT)
>    out = p.communicate("hoge")[0]
>    print "%s %s" % (current_thread().name, out)

If, instead of spawning workers you directly call worker(), does it succeed?

I suspect the threading is a red herring here.

-- 
Jed Smith
j...@jedsmith.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: help!!!

2010-10-11 Thread Jed Smith
On Mon, Oct 11, 2010 at 5:02 PM, Seebs  wrote:

> and something like scanf(), where I've never heard of a compiler doing 
> anything of the sort.

By default, MSVC complains hard enough when using scanf() to make you
regret it (I think? been a while).

-- 
Jed Smith
j...@jedsmith.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Missing modules for python

2010-10-12 Thread Jed Smith
On Mon, Oct 11, 2010 at 7:02 PM, Steven D'Aprano
 wrote:
> On Mon, 11 Oct 2010 10:32:44 -0400, Jed Smith wrote:
>
>> simplejson got merged into the standard library in Python 2.6. In
>> libcloud, I wrote this:
>>
>>   try: import json
>>   except ImportError, excp: import simplejson as json
>
> I'm curious why you bother to bind the exception to the excp when you
> don't actually use it? If this occurs in the top level of a module, it
> just introduces an apparently unneeded and unused global name.

Typed from memory, and now that you mention it, I don't think I
actually did. At any rate, we mandated 2.6 and it's no longer there.

-- 
Jed Smith
j...@jedsmith.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Python default search paths

2010-10-19 Thread Jed Smith
On Tue, Oct 19, 2010 at 12:35 PM, Steven D'Aprano
 wrote:
> On Tue, 19 Oct 2010 06:25:30 -0700, swapnil wrote:
>> This is useful for embedding applications where it might be desired that
>> only user-defined paths are searched for modules.
>
> I doubt that very much. I expect that many things will break if Python
> can't find (e.g.) the sys module. But you might be lucky.

sys is a bad example, because it is built-in and always available[1],
even if the path is destroyed.

I have personally done what OP is trying to do. It is not only
possible (but interesting) to give Python access only to your own
modules. It's similar to working in C without libc, and is just as
feasible and doable. Running with -vv is very useful here, so you can
see what Python does behind the scenes--the default site scripts
actually import quite a bit before handing off to you, and even if
path is wiped, those will continue to work (i.e., os; go interactive,
import sys, sys.path = [], then try importing os and, say, cgi).

Python doesn't expect to run this way so there's a few things you have
to work around, but I expect there's more than a few apps that operate
just like this.

[1]: http://docs.python.org/library/sys.html

-- 
Jed Smith
j...@jedsmith.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: annoying CL echo in interactive python / ipython

2010-10-19 Thread Jed Smith
On Tue, Oct 19, 2010 at 1:37 PM, kj  wrote:

> % stty -echo

That doesn't do what you think it does.

-- 
Jed Smith
j...@jedsmith.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: annoying CL echo in interactive python / ipython

2010-10-19 Thread Jed Smith
On Tue, Oct 19, 2010 at 2:35 PM, kj  wrote:
> In  Jed Smith 
>  writes:
>
>>On Tue, Oct 19, 2010 at 1:37 PM, kj  wrote:
>
>>> % stty -echo
>
>>That doesn't do what you think it does.
>
> Gee, thanks.  That really helped.  I'll go talk to my guru now,
> and meditate over this.

You're right, I could have been more clear. I was nudging you to go
read the man page of stty(1), but since you won't and want to get
snarky instead, I will for you:

> echo (-echo)
> Echo back (do not echo back) every character typed.

I'm going to guess that the percent sign in your prompt indicates that
you're using zsh(1).  With my minimally-customized zsh, the echo
option is reset every time the prompt is displayed. That means you can
type "stty -echo", push CR, the echo option is cleared, then zsh
immediately sets it before you get to type again. Therefore, you
cannot observe its *actual* behavior, and you assumed it had something
to do with what you're after. Am I on the right track?

Start bash, run stty -echo, then type. That is the ACTUAL behavior of
that option.

As to your original issue, your readline configuration is most likely
the problem. I consider it very unlikely that Python has anything to
do with it. I have no idea why fiddling with your terminal affects
readline, but there is a lot that I do not understand about readline.

-- 
Jed Smith
j...@jedsmith.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: annoying CL echo in interactive python / ipython

2010-10-19 Thread Jed Smith
On Tue, Oct 19, 2010 at 3:33 PM, Hrvoje Niksic  wrote:
> Jed Smith  writes:
>
>>>     echo (-echo)
>>>                 Echo back (do not echo back) every character typed.
>>
>> I'm going to guess that the percent sign in your prompt indicates that
>> you're using zsh(1).  With my minimally-customized zsh, the echo
>> option is reset every time the prompt is displayed. That means you can
>> type "stty -echo", push CR, the echo option is cleared, then zsh
>> immediately sets it before you get to type again.
>
> But are you running zsh in an emacs shell window?  Emacs shell is not a
> terminal emulator, it lets emacs do the editing, and only sends it to
> the shell when enter is pressed.  To avoid clashing with readline and
> equivalent (ZLE in case of zsh), emacs presents itself as a dumb
> terminal, which should make zsh turn ZLE off.

I'll take your word for it, as I don't use emacs. That makes sense,
though, as while researching this question I did find documentation
that suggests zsh disables ZLE under emacs.

OP, it sounds like in this circumstance, then, that you want
interactive Python without readline (which means a recompile, and from
a quick Google it sounds like it might not work). I'd leave readline
in the system Python and just tell emacs to use my custom one without
it, if I were you.

(Or save the trouble and just run ipy in a separate xterm :>)

-- 
Jed Smith
j...@jedsmith.org
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: What people are using to access this mailing list

2010-11-03 Thread Jed Smith
On Wed, Nov 3, 2010 at 4:02 AM, John Bond  wrote:
> My normal inbox is getting unmanageable, and I think I need to find a new way
> of following this and other lists.

I have to second (or third) the Gmail suggestion. I use Google Apps
against my domain, and the Gmail interface is frightfully good at
creating filters. For example, on most lists (particularly Mailman), I
can hit "Filter messages like this", and Gmail automatically harvests
the List header and writes a filter for it.

I just prefer the Gmail philosophy to mail, with tags that are *like*
folders but not really.

-- 
Jed Smith
j...@jedsmith.org
-- 
http://mail.python.org/mailman/listinfo/python-list