Re: [Python-Dev] thoughts on having EOFError inherit from EnvironmentError?
Greg Ewing canterbury.ac.nz> writes: > > Really? Nobody else wants a convenient way to > distinguish program bugs from exceptions caused > by external factors? Why do you want to derive program bugs from EnvironmentError ? Usually I derive them from ValueError, RuntimeError or simply Exception. ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Interface to change Py3kWarning in Python
Benjamin Peterson schrieb: > I currently have a patch to make it possible to change py3k warnings > in Python through new functions in sys: issue 2458. I realize the > functions are rather ugly, but I don't think there is another > practical way to do it unless you want to be writing PySys_GetObject > and checking it for NULL whenever you add a Py3k warning. In Python we usually have to methods for the job, like set_py3kwarningmode and get_py3kwarningmode. I don't like the enable* and disable* style. Even the get/set methods are an ugly workaround for the fact, Python doesn't support module properties. :/ How do you like a macro or function PyErr_Warn3k(msg) that does all the dirty work? Christian ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Need help in MAPI
Hi, My Code: mapi.MAPIInitialize(None) session = mapi.MAPILogonEx(0, MAPIProfile, None, mapi.MAPI_EXTENDED | mapi.MAPI_USE_DEFAULT) I am trying to send a mail using the extended MAPI interface, I am new to work with MAPI. I am trying to execute your code,i getting the following exception, and a popup message of Either there is no default mail client or the current mail client cannot fullfill the messaging request,please run Microsoftoffice outlookand set it as the defaukt mail client. I am using thunderbird as my default mail client , then i set my outlook as my default mail client.its running fine. can u tell me is there possiblites to run the code with out changing the default mail client to Ms Outlook. if could u find me a solution,that'd really helpfull. Error: C:\Documents and Settings\Administrator\Desktop>python mapisend.py Traceback (most recent call last): File "mapisend.py", line 85, in SendEMAPIMail(SendSubject, SendMessage, SendTo, MAPIProfile=MAPIProfile) File "mapisend.py", line 23, in SendEMAPIMail mapi.MAPIInitialize(None) pywintypes.com_error: (-2147467259, 'Unspecified error', None, None) ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Known doctest bug with unicode?
Is it a known doctest bug that when you have a dict with Unicode key values that doctest dies with a KeyError? When I excute my code from the regular python interpreter it works as expected. -- Jeroen Ruigrok van der Werven / asmodai イェルーン ラウフロック ヴァン デル ウェルヴェン http://www.in-nomine.org/ | http://www.rangaku.org/ Whenever you meet difficult situations dash forward bravely and joyfully... ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Known doctest bug with unicode?
Can you provide an example that fails? This seems to work on my end, for
instance:
>>> mydict = { u'\u2026' : 'ellipsis' }
>>> mydict[u'\u2026']
'ellipsis'
- Atul
On Fri, Apr 18, 2008 at 7:12 AM, Jeroen Ruigrok van der Werven <
[EMAIL PROTECTED]> wrote:
> Is it a known doctest bug that when you have a dict with Unicode key
> values
> that doctest dies with a KeyError?
>
> When I excute my code from the regular python interpreter it works as
> expected.
>
> --
> Jeroen Ruigrok van der Werven / asmodai
> イェルーン ラウフロック ヴァン デル ウェルヴェン
> http://www.in-nomine.org/ | http://www.rangaku.org/
> Whenever you meet difficult situations dash forward bravely and
> joyfully...
> ___
> Python-Dev mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/varmaa%40gmail.com
>
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Known doctest bug with unicode?
# vim: set fileencoding=utf-8 :
kanamap = {
u'あ': 'a'
}
def transpose(word):
"""Convert a word in kana to its equivalent Hepburn romanisation.
>>> transpose(u'あ')
'a'
"""
transposed = ''
for character in word:
transposed += kanamap[character]
return transposed
if __name__ == '__main__':
import doctest
doctest.testmod()
doctest:
[16:24] [EMAIL PROTECTED] (1) {20} % python trans.py
**
File "trans.py", line 11, in __main__.transpose
Failed example:
transpose(u'あ')
Exception raised:
Traceback (most recent call last):
File "doctest.py", line 1212, in __run
compileflags, 1) in test.globs
File "", line 1, in
transpose(u'あ')
File "trans.py", line 16, in transpose
transposed += kanamap[character]
KeyError: u'\xe3'
**
1 items had failures:
1 of 1 in __main__.transpose
***Test Failed*** 1 failures.
normal interpreter:
>>> fromm trans import transpose
>>> transpose(u'あ')
'a'
--
Jeroen Ruigrok van der Werven / asmodai
イェルーン ラウフロック ヴァン デル ウェルヴェン
http://www.in-nomine.org/ | http://www.rangaku.org/
They have learned nothing, and forgotten nothing...
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Need help in MAPI
Hello, Antony Joseph wrote: > Hi, > > My Code: > mapi.MAPIInitialize(None) > session = mapi.MAPILogonEx(0, MAPIProfile, None, > mapi.MAPI_EXTENDED | mapi.MAPI_USE_DEFAULT) > > I am trying to send a mail using the extended MAPI interface, I am > new to work with MAPI. > I am trying to execute your code,i getting the following exception, and a > popup message of Either there is no default mail client or the current mail > client cannot fullfill the messaging request,please run Microsoftoffice > outlookand set it as the defaukt mail client. > I am using thunderbird as my default mail client , then i set my outlook as > my default mail client.its running fine. > can u tell me is there possiblites to run the code with out changing the > default mail client to Ms Outlook. First, this mailing list is for the development of the python language, not for development with python. Please ask this kind of questions on the comp.lang.python newsgroup. Then, your problem is not related to python at all. The same call from any other program would return the same error. A quick google search gave: http://www.tech-archive.net/Archive/Development/microsoft.public.win32.programmer.messaging/2007-04/msg00036.html which describes the same problem (and a solution) Otherwise you are welcome ;-) -- Amaury Forgeot d'Arc ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Known doctest bug with unicode?
On Fri, Apr 18, 2008 at 8:27 AM, Jeroen Ruigrok van der Werven
<[EMAIL PROTECTED]> wrote:
> # vim: set fileencoding=utf-8 :
>
> kanamap = {
> u'あ': 'a'
> }
>
> def transpose(word):
> """Convert a word in kana to its equivalent Hepburn romanisation.
>
> >>> transpose(u'あ')
> 'a'
> """
> transposed = ''
> for character in word:
> transposed += kanamap[character]
> return transposed
>
> if __name__ == '__main__':
> import doctest
> doctest.testmod()
>
> doctest:
>
> [16:24] [EMAIL PROTECTED] (1) {20} % python trans.py
> **
> File "trans.py", line 11, in __main__.transpose
> Failed example:
> transpose(u'あ')
> Exception raised:
> Traceback (most recent call last):
> File "doctest.py", line 1212, in __run
> compileflags, 1) in test.globs
> File "", line 1, in
> transpose(u'あ')
> File "trans.py", line 16, in transpose
> transposed += kanamap[character]
> KeyError: u'\xe3'
> **
> 1 items had failures:
>1 of 1 in __main__.transpose
> ***Test Failed*** 1 failures.
>
> normal interpreter:
>
> >>> fromm trans import transpose
> >>> transpose(u'あ')
> 'a'
What you've got is an 8-bit string containing a unicode literal.
Since this gets past the module's compilation stage, it doctest passes
it to the compiler again, and it defaults to iso-8859-1. Thus
u'あ'.encode('utf-8').decode('latin-1') -> u'\xe3\x81\x82'.
Possible solutions:
1. Make the docstring itself unicode, assuming doctest allows this.
2. Call doctest explicitly, giving it the correct encoding.
3. See if you can put an encoding declaration in the doctest itself.
4. Make doctest smarter, so that it can grab the original module's encoding.
5. Wait until 3.0, where this is hopefully fixed by making doctests
use unicode by default?
--
Adam Olsen, aka Rhamphoryncus
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Summary of Tracker Issues
ACTIVITY SUMMARY (04/11/08 - 04/18/08)
Tracker at http://bugs.python.org/
To view or respond to any of the issues listed below, click on the issue
number. Do NOT respond to this message.
1839 open (+31) / 12641 closed ( +7) / 14480 total (+38)
Open issues with patches: 550
Average duration of open issues: 706 days.
Median duration of open issues: 1317 days.
Open Issues Breakdown
open 1817 (+31)
pending22 ( +0)
Issues Created Or Reopened (39)
___
Patch to emit "-J is reserved for Jython" on -J arg 04/11/08
CLOSED http://bugs.python.org/issue2617created fwierzbicki
patch
Tile module: Add support for themed widgets 04/11/08
http://bugs.python.org/issue2618created wordtech
Document memoryview 04/11/08
http://bugs.python.org/issue2619created benjamin.peterson
Multiple buffer overflows in unicode processing 04/11/08
http://bugs.python.org/issue2620created jnferguson
rename test_support to support 04/12/08
http://bugs.python.org/issue2621created benjamin.peterson
patch, easy
Import errors in email.message.py04/12/08
http://bugs.python.org/issue2622created JohnJackson
Patch: xmlrpclib client ignores datetime tzinfo when creating is 04/12/08
http://bugs.python.org/issue2623created lclark
patch
swig support in distutils should use the build and temp dirs 04/12/08
http://bugs.python.org/issue2624created afflux
patch
mailbox.MH.get_message() treats result of get_sequences() as lis 04/12/08
http://bugs.python.org/issue2625created hcs
If compile with gcc 4.3.0 python interpreter itself eats all mem 04/12/08
CLOSED http://bugs.python.org/issue2626created orivej
mark pgen generated files04/13/08
CLOSED http://bugs.python.org/issue2627created benjamin.peterson
patch, easy
ftplib Persistent data connection04/13/08
http://bugs.python.org/issue2628created jbell
patch
_Py_ForgetReference crash when called from _PyUnicode_New on Mem 04/14/08
http://bugs.python.org/issue2629created gregory.p.smith
repr() should not escape non-ASCII characters04/14/08
http://bugs.python.org/issue2630created ishimoto
patch
IMPORT_NAME Documentation is incomplete 04/14/08
http://bugs.python.org/issue2631created pib
performance problem in socket._fileobject.read 04/14/08
http://bugs.python.org/issue2632created CurtHagenlocher
patch
Improve subprocess.Popen() documentation ("env" parameter) 04/14/08
http://bugs.python.org/issue2633created roysmith
os.execvpe() docs need to be more specific 04/15/08
http://bugs.python.org/issue2634created roysmith
textwrap: bug in 'fix_sentence_endings' option 04/15/08
http://bugs.python.org/issue2635created gscelsi
Regexp 2.6 (modifications to current re 2.2.2)
Re: [Python-Dev] Proposed unittest changes
Michael Foord wrote: > that the 'assert' statement should be used > instead of 'assert_'. assert statements are actually a bad idea in tests - they get skipped when the test suite is run with optimisation switched on. Cheers, Nick. -- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --- http://www.boredomandlaziness.org ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Interface to change Py3kWarning in Python
On Fri, Apr 18, 2008 at 7:38 AM, Christian Heimes <[EMAIL PROTECTED]> wrote: > Benjamin Peterson schrieb: > > > > In Python we usually have to methods for the job, like > set_py3kwarningmode and get_py3kwarningmode. I don't like the enable* > and disable* style. Even the get/set methods are an ugly workaround for > the fact, Python doesn't support module properties. :/ I will look at that. > > How do you like a macro or function PyErr_Warn3k(msg) that does all the > dirty work? Sounds lovely. > > Christian > > -- Cheers, Benjamin Peterson ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] unscriptable?
Consider this error: >>> 3["something"] Traceback (most recent call last): File "", line 1, in TypeError: 'int' object is unsubscriptable "unscriptable" seems rather ambiguous. How about "[object] cannot be indexed"? -- Cheers, Benjamin Peterson ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] unscriptable?
On Fri, Apr 18, 2008 at 5:43 PM, Benjamin Peterson <[EMAIL PROTECTED]> wrote: > Consider this error: > >>> 3["something"] > Traceback (most recent call last): > File "", line 1, in > TypeError: 'int' object is unsubscriptable > > "unscriptable" seems rather ambiguous. How about "[object] cannot be > indexed"? Titus just noticed that I confused "unscriptable" with "unsubscriptable." :P Still, though, unsubscriptable seems to be a Python invented word. What does (un)subscriptable even mean? > > -- > Cheers, > Benjamin Peterson > -- Cheers, Benjamin Peterson ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] unscriptable?
Benjamin Peterson wrote: > Consider this error: 3["something"] > Traceback (most recent call last): > File "", line 1, in > TypeError: 'int' object is unsubscriptable > > "unscriptable" seems rather ambiguous. How about "[object] cannot be indexed"? > Although I think this is a bit of bike-shedding, I would point out that CPython is itself inconsistent about this: >>> set([1,2,3])[0] Traceback (most recent call last): File "", line 1, in TypeError: 'set' object is unindexable I tend to agree with Benjamin that "unsubscriptable" is a made-up word, but so is "unindexable". So, whatever. -Scott -- Scott Dial [EMAIL PROTECTED] [EMAIL PROTECTED] ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] unscriptable?
Scott Dial wrote: > Benjamin Peterson wrote: > >> Consider this error: >> > 3["something"] > >> Traceback (most recent call last): >> File "", line 1, in >> TypeError: 'int' object is unsubscriptable >> >> "unscriptable" seems rather ambiguous. How about "[object] cannot be >> indexed"? >> >> > > Although I think this is a bit of bike-shedding, I would point out that > CPython is itself inconsistent about this: > > >>> set([1,2,3])[0] > Traceback (most recent call last): >File "", line 1, in > TypeError: 'set' object is unindexable > > I tend to agree with Benjamin that "unsubscriptable" is a made-up word, > but so is "unindexable". So, whatever. > It seems to be more common in the 'Python world' to refer to indexing than subscription and I admit that this error message has confused me in the past. Michael > -Scott > > ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] unscriptable?
> I tend to agree with Benjamin that "unsubscriptable" is a made-up word, > but so is "unindexable". So, whatever. FWIW, here is what other tools give as error message in similar cases: gcc: subscripted value is neither array nor pointer g++: invalid types ‘double[int]’ for array subscript javac: array required, but X found ruby: undefined method `[]=' for 1:Fixnum (NoMethodError) See also http://tinyurl.com/4nn284 Regards, Martin ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] thoughts on having EOFError inherit from EnvironmentError?
Antoine Pitrou wrote:
> Why do you want to derive program bugs from EnvironmentError ? Usually I
> derive
> them from ValueError, RuntimeError or simply Exception.
I'm *not* talking about program bugs, I'm talking about
exceptions due to something the user did wrong.
I like to be able to do this:
try:
f = open(somefile)
mungulate(f)
f.close()
except EnvironmentError, e:
big_nasty_alert("Couldn't mungulate: %s" % e)
I *don't* want this to catch things like TypeError and
ValueError that indicate a program bug if they ever
escape. I want those to propagate and cause a traceback
or get handled at a higher level.
By deriving my own external-factors exceptions from
EnvironmentError, this all works very nicely.
From its position in the exception hierarchy, this
seems to be just the sort of thing that EnvironmentError
is designed for, and I'm perplexed to be told that
it's not.
--
Greg
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] unscriptable?
Michael Foord wrote: > It seems to be more common in the 'Python world' to refer to indexing > than subscription Especially since the subscript isn't actually written as a subscript, unless you have a particulary fancy code editor... -- Greg ___ Python-Dev mailing list [email protected] http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] thoughts on having EOFError inherit from EnvironmentError?
On Sat, 19 Apr 2008 12:18:47 +1200
Greg Ewing <[EMAIL PROTECTED]> wrote:
> Antoine Pitrou wrote:
>
> > Why do you want to derive program bugs from EnvironmentError ? Usually I
> > derive
> > them from ValueError, RuntimeError or simply Exception.
>
> I'm *not* talking about program bugs, I'm talking about
> exceptions due to something the user did wrong.
>
> I like to be able to do this:
>
>try:
> f = open(somefile)
> mungulate(f)
> f.close()
>except EnvironmentError, e:
> big_nasty_alert("Couldn't mungulate: %s" % e)
It might help if you explain what sort of actual things that the user does
wrong that you are talking about. From where I'm sitting, the only thing I
can see that the user could do wrong is specify the wrong file. That doesn't
sound like an EnvironmentError to me, but I don't know that it should be a
ValueError or TypeError either.
--
Steven <[EMAIL PROTECTED]>
___
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
