[issue6417] multiprocessing Process examples: print and getppid

2010-10-12 Thread Michael Newman

Michael Newman michael.b.new...@gmail.com added the comment:

The example is working correctly for:
Python 3.2a3 (r32a3:85355, Oct 10 2010, 17:11:45) [MSC v.1500 32 bit (Intel)] 
on win32

# First test:
C:\mikec:\Python32\python.exe s2.py
main line
module name: __main__
parent process: 2360
process id: 1584
function f
module name: __main__
parent process: 1584
process id: 3588
hello bob

# Second test (run it again to see process IDs change)
C:\mikec:\Python32\python.exe s2.py
main line
module name: __main__
parent process: 2360
process id: 5904
function f
module name: __main__
parent process: 5904
process id: 1560
hello bob

# For reference:
C:\mikec:\Python32\python.exe
Python 3.2a3 (r32a3:85355, Oct 10 2010, 17:11:45) [MSC v.1500 32 bit (Intel)] 
on win32
Type help, copyright, credits or license for more information.
 import os
 os.getppid()
2360

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6417
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8011] traceback tb_lineno example needs correction for Python3

2010-03-13 Thread Michael Newman

Michael Newman michael.b.new...@gmail.com added the comment:

No problem. Please note its actually fixed in r78895 (trunk), r78896 (py3k) and 
r78897 (release31-maint). Your previous message had the svn revision numbers 
off by 1000.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8011
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6436] trace module doesn't seem to produce .cover files for Py3 (but does for Py2)

2010-02-21 Thread Michael Newman

Michael Newman michael.b.new...@gmail.com added the comment:

I noticed the same behavior today.

Let's consider a test case using my python script version_check.py (attached).

Normally the script does the following on my Ubuntu 9.10 box:

# Python 2.6 example:
m...@ebx2009:~/test$ which python
/usr/bin/python
m...@ebx2009:~/test$ python version_check.py
2.6.4 (r264:75706, Dec  7 2009, 18:45:15) 
[GCC 4.4.1]

# Python 3.1 example:
m...@ebx2009:~/test$ which python3
/usr/local/bin/python3
m...@ebx2009:~/test$ python3 version_check.py
3.1.1 (r311:74480, Feb  7 2010, 16:32:28) 
[GCC 4.4.1]

# Starting with a directory with only the script in it:
m...@ebx2009:~/test$ ls
version_check.py
# I use the -C . to force the .cover files to be dumped in my current 
directory:
m...@ebx2009:~/test$ python -m trace --count -C . version_check.py 
2.6.4 (r264:75706, Dec  7 2009, 18:45:15) 
[GCC 4.4.1]
m...@ebx2009:~/test$ ls
threading.cover  version_check.cover  version_check.py
# So this worked fine.

# Let's remove the cover files and try with Python 3.1:
m...@ebx2009:~/test$ rm *.cover
m...@ebx2009:~/test$ ls
version_check.py
m...@ebx2009:~/test$ python3 -m trace --count -C . version_check.py 
3.1.1 (r311:74480, Feb  7 2010, 16:32:28) 
[GCC 4.4.1]
m...@ebx2009:~/test$ ls
threading.cover  version_check.py
# Its annoying that the threading.cover is still being made, but 
version_check.cover did not get generated in any case...

I tracked the problem down inside of lib/trace.py (same code in both python 
versions):

def localtrace_count(self, frame, why, arg):
if why == line:
filename = frame.f_code.co_filename
print(frame.f_code.co_filename)  # my new debug line
lineno = frame.f_lineno
key = filename, lineno
self.counts[key] = self.counts.get(key, 0) + 1
return self.localtrace

If you put my print debug line in, we get some more interesting behavior from 
my example runs:

m...@ebx2009:~/test$ python -m trace --count -C . version_check.py 
/usr/lib/python2.6/threading.py
string
version_check.py
version_check.py
version_check.py
version_check.py
version_check.py
version_check.py
2.6.4 (r264:75706, Dec  7 2009, 18:45:15) 
[GCC 4.4.1]

m...@ebx2009:~/test$ python3 -m trace --count -C . version_check.py 
/usr/local/lib/python3.1/threading.py
string
string
string
string
string
string
string
3.1.1 (r311:74480, Feb  7 2010, 16:32:28) 
[GCC 4.4.1]

So python3 is not retaining the module name correctly. Instead its just giving 
string. So the bottom line is frame.f_code.co_filename is now behaving 
differently. I'm not sure how to fix that.

--
nosy: +mnewman
versions: +Python 3.2
Added file: http://bugs.python.org/file16282/version_check.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6436
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7929] Update copyright notice on python websites to 2010

2010-02-21 Thread Michael Newman

Michael Newman michael.b.new...@gmail.com added the comment:

Perhaps this is now really a bug:

# Response to e-mail to webmas...@python.org:
#

This is the mail system at host mail.python.org.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

  The mail system

webmaster-reply...@mail.python.org (expanded from webmas...@python.org):
   Command died with status 1: /usr/bin/replybot -C /etc/replybot.cfg -s
   WEBMASTER. Command output: Traceback (most recent call last):   File
   /usr/bin/replybot, line 5, in module from pkg_resources import
   load_entry_point ImportError: No module named pkg_resources

Final-Recipient: rfc822; webmaster-reply...@mail.python.org
Original-Recipient: rfc822;webmas...@python.org
Action: failed
Status: 5.3.0
Diagnostic-Code: x-unix; Traceback (most recent call last):   File
   /usr/bin/replybot, line 5, in module from pkg_resources import
   load_entry_point ImportError: No module named pkg_resources


-- Forwarded message --
From: Michael Newman michael.b.new...@gmail.com
To: webmas...@python.org
Date: Sun, 21 Feb 2010 15:31:31 -0500
Subject: please update copyright to show 2010
Please consider fixing this bug:

Update copyright notice on python websites to 2010
http://bugs.python.org/issue7929

Thanks for maintaining a great website.

-Mike

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7929
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7929] Update copyright notice on python websites to 2010

2010-02-21 Thread Michael Newman

Michael Newman michael.b.new...@gmail.com added the comment:

I posted the copyright note, and the reply bot bug on the wiki at:
http://wiki.python.org/moin/SiteImprovements

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7929
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7964] -m pdb SyntaxError for \r\n formatted py files

2010-02-19 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

Attached is a version checking script. When you run it normally, it produces 
output such as:

E:\notes\Programming\python3c:\Python26\python.exe version_check.py
2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)]

E:\notes\Programming\python3c:\Python31\python.exe version_check.py
3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)]

I wanted to test using -m pdb on this script. It works okay for Python 2.6:

E:\notes\Programming\python3c:\Python26\python.exe -m pdb version_check.py
 e:\notes\programming\python3\version_check.py(4)module()
- Last Updated: 2008-12-21
(Pdb) c
2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)]
The program finished and will be restarted
 e:\notes\programming\python3\version_check.py(4)module()
- Last Updated: 2008-12-21
(Pdb) q

However, if I try it on Python 3.1 I get a SyntaxError:

# --- Begin Python 3.1 Example with \r\n source code --- #

E:\notes\Programming\python3c:\Python31\python.exe -m pdb version_check.py
SyntaxError: ('invalid syntax', ('e:\\notes\\programming\\python3\\version_check
.py', 4, 132, 'Check what version of python is running.\r\n\r\nWritten by: Mi
chael Newman michael.b.new...@gmail.com\r\nLast Updated: 2008-12-21\r\n'))
 string(1)module()
(Pdb) c
Traceback (most recent call last):
  File c:\Python31\lib\pdb.py, line 1297, in main
pdb._runscript(mainpyfile)
  File c:\Python31\lib\pdb.py, line 1216, in _runscript
self.run(statement)
  File c:\Python31\lib\bdb.py, line 378, in run
exec(cmd, globals, locals)
  File string, line 1, in module
  File e:\notes\programming\python3\version_check.py, line 4
Check what version of python is running.

Written by: Michael Newman michael.b.new...@gmail.com
Last Updated: 2008-12-21



^
SyntaxError: invalid syntax
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
 string(1)module()
(Pdb) q
Post mortem debugger finished. The version_check.py will be restarted
SyntaxError: ('invalid syntax', ('e:\\notes\\programming\\python3\\version_check
.py', 4, 132, 'Check what version of python is running.\r\n\r\nWritten by: Mi
chael Newman michael.b.new...@gmail.com\r\nLast Updated: 2008-12-21\r\n'))
 string(1)module()
(Pdb) q

# --- End Python 3.1 Example with \r\n source code --- #

As a hunch, my program is has Windows style line endings \r\n, so I saved the 
file to another file name and converted it to Unix style \n line endings... 
and this version does work:

# --- Begin Python 3.1 Example using \n source code --- #

E:\notes\Programming\python3copy version_check.py version_check_unix.py
1 file(s) copied.

E:\notes\Programming\python3which d2u
C:\Program Files\GnuWin32\bin\d2u.EXE

E:\notes\Programming\python3d2u version_check_unix.py
version_check_unix.py: done.

E:\notes\Programming\python3py31 -m pdb version_check_unix.py
 e:\notes\programming\python3\version_check_unix.py(4)module()
- Last Updated: 2008-12-21
(Pdb) c
3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)]
The program finished and will be restarted
 e:\notes\programming\python3\version_check_unix.py(4)module()
- Last Updated: 2008-12-21
(Pdb) q

# --- End Python 3.1 Example using \n source code --- #

Is \r\n not officially supported by -m pdb? Or is this a bug?

--
components: Library (Lib)
files: version_check.py
messages: 99570
nosy: mnewman
severity: normal
status: open
title: -m pdb SyntaxError for \r\n formatted py files
type: behavior
versions: Python 3.1, Python 3.2
Added file: http://bugs.python.org/file16256/version_check.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7964
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7956] unittest.Testcase assertDictContainsSubset with integer keys

2010-02-18 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

The attached example unit test file shows that assertDictContainsSubset cannot 
handle error messages that need to show integer keys. Below is the output of 
the test suite, where test_mixed_keys_fail has an error (code mistake), while 
test_text_keys_fail produces a failure (result mistake) as expected.

C:\notesC:\Python31\python.exe test_one_and_one.py
.E.F
==
ERROR: test_mixed_keys_fail (__main__.Test_one_and_one)
--
Traceback (most recent call last):
  File test_one_and_one.py, line 30, in test_mixed_keys_fail
self.assertDictContainsSubset({3: this does not exist}, self.dict_with_mix
ed_keys)
  File C:\python31\lib\unittest.py, line 908, in assertDictContainsSubset
standardMsg = 'Missing: %r' % ','.join(missing)
TypeError: sequence item 0: expected str instance, int found

==
FAIL: test_text_keys_fail (__main__.Test_one_and_one)
--
Traceback (most recent call last):
  File test_one_and_one.py, line 33, in test_text_keys_fail
self.assertDictContainsSubset({3: this does not exist}, self.dict_with_t
ext_keys)
AssertionError: Missing: '3'

--
Ran 4 tests in 0.010s

FAILED (failures=1, errors=1)

--
components: Library (Lib)
files: test_one_and_one.py
messages: 99500
nosy: mnewman
severity: normal
status: open
title: unittest.Testcase assertDictContainsSubset with integer keys
type: behavior
versions: Python 3.1, Python 3.2
Added file: http://bugs.python.org/file16250/test_one_and_one.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7956
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7960] test.support.captured_output has invalid docstring example

2010-02-18 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

test.support.captured_output is not covered in the online documents:
http://docs.python.org/3.1/library/test.html
http://docs.python.org/dev/py3k/library/test.html

However, it does have a docstring in C:\Python31\Lib\test\support.py (see 
below). The current example for captured_output does not work. Looks like 
someone moved it from captured_stdout but did not fully update it. Note the 
old example still references captured_stdout. 

# Here's the current code in support.py:

@contextlib.contextmanager
def captured_output(stream_name):
Run the 'with' statement body using a StringIO object in place of a
specific attribute on the sys module.
Example use (with 'stream_name=stdout')::

   with captured_stdout() as s:
   print(hello)
   assert s.getvalue() == hello

import io
orig_stdout = getattr(sys, stream_name)
setattr(sys, stream_name, io.StringIO())
try:
yield getattr(sys, stream_name)
finally:
setattr(sys, stream_name, orig_stdout)

def captured_stdout():
return captured_output(stdout)

# Example for captured_output should now be:

   with captured_output(stdout) as s:
   print(hello)
   assert s.getvalue() == hello

# It would be nice to reconcile the online doc versus the docstrings, since it 
confusing and makes me confused whether captured_stdout is deprecated.

--
assignee: georg.brandl
components: Documentation
messages: 99529
nosy: georg.brandl, mnewman
severity: normal
status: open
title: test.support.captured_output has invalid docstring example
versions: Python 3.1, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7960
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7930] pydoc.stripid doesn't strip ID in py25, py26, py31

2010-02-14 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

I found that pydoc.stripid doesn't strip the ID in Python 2.5, 2.6, and 3.1. I 
assume the problem is probably present in 2.7 and 3.2/dev.

For a little history, see this older issue back for Python 2.3:
http://bugs.python.org/issue934282

The following example show pydoc.stripid works for Python 2.3 and 2.4, but 
then fails for versions after that.

Python 2.3.5 (#62, Feb  8 2005, 16:23:02) [MSC v.1200 32 bit (Intel)] on win32
Type help, copyright, credits or license for more information.
 import pydoc
 pydoc.stripid
function stripid at 0x00AC0BB0
 pydoc.stripid(repr(pydoc.stripid))
'function stripid'

Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on win32
Type help, copyright, credits or license for more information.
 import pydoc
 pydoc.stripid
function stripid at 0x00BB7BF0
 pydoc.stripid(repr(pydoc.stripid))
'function stripid'

Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on 
win32
Type help, copyright, credits or license for more information.
 import pydoc
 pydoc.stripid
function stripid at 0x00BEFCF0
 pydoc.stripid(repr(pydoc.stripid))
'function stripid at 0x00BEFCF0'

Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on 
win32
Type help, copyright, credits or license for more information.
 import pydoc
 pydoc.stripid
function stripid at 0x00C655B0
 pydoc.stripid(repr(pydoc.stripid))
'function stripid at 0x00C655B0'

Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)] on 
win32
Type help, copyright, credits or license for more information.
 import pydoc
 pydoc.stripid
function stripid at 0x00CFB8A0
 pydoc.stripid(repr(pydoc.stripid))
'function stripid at 0x00CFB8A0'

--
components: Library (Lib)
messages: 99349
nosy: mnewman
severity: normal
status: open
title: pydoc.stripid doesn't strip ID in py25, py26, py31
type: behavior
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7930
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7888] turtle settiltangle should be marked deprecated, not tiltangle

2010-02-08 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

In the turtle module documentation:
http://docs.python.org/3.1/library/turtle.html
http://docs.python.org/py3k/library/turtle.html

Currently it says Deprecated since Python 3.1 under the turtle.tiltangle 
section. That should be under turtle.settiltangle instead.

For reference, the comments at the end of the documentation page correctly 
explains:
Turtle.tiltangle() has been enhanced in functionality: it now can be used to 
get or set the tiltangle. Turtle.settiltangle() has been deprecated.

--
assignee: georg.brandl
components: Documentation
messages: 99077
nosy: georg.brandl, mnewman
severity: normal
status: open
title: turtle settiltangle should be marked deprecated, not tiltangle
versions: Python 3.1, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7888
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7814] SimpleXMLRPCServer Example uses mul instead of div in client portion

2010-01-30 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

In 20.24.1.1. SimpleXMLRPCServer Example:
http://docs.python.org/3.1/library/xmlrpc.server.html

The client portion of the example uses mul, which does not exist in the 
server portion. The easiest fix to change the client to use div instead of 
mul.

# Attempt to use client code exactly as provided:
# Python 3.1.1 (r311:74483) on win32
E:\notes\Programming\python3\lib\xmlrpc.serverpy31 example1_xmlrpc_client.py
8
5
Traceback (most recent call last):
  File example1_xmlrpc_client.py, line 11, in module
print(s.mul(5,2))  # Returns 5*2 = 10
  File C:\python31\lib\xmlrpc\client.py, line 1029, in __call__
return self.__send(self.__name, args)
  File C:\python31\lib\xmlrpc\client.py, line 1271, in __request
verbose=self.__verbose
  File C:\python31\lib\xmlrpc\client.py, line 1070, in request
return self.parse_response(resp)
  File C:\python31\lib\xmlrpc\client.py, line 1169, in parse_response
return u.close()
  File C:\python31\lib\xmlrpc\client.py, line 673, in close
raise Fault(**self._stack[0])
xmlrpc.client.Fault: Fault 1: 'class \'Exception\':method mul is not 
supported'

To fix it, I changed this line in the client code:

print(s.mul(5,2))  # Returns 5*2 = 10

to:

print(s.div(8,2))  # Returns 8/2 = 4

# Here's how it now looks after the suggested fix:
E:\notes\Programming\python3\lib\xmlrpc.serverpy31 example1_xmlrpc_client_rev1.
py
8
5
4
['add', 'div', 'pow', 'system.listMethods', 'system.methodHelp', 
'system.methodSignature']

--
assignee: georg.brandl
components: Documentation
messages: 98567
nosy: georg.brandl, mnewman
severity: normal
status: open
title: SimpleXMLRPCServer Example uses mul instead of div in client portion
versions: Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7814
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7801] xmlrpc.client binary object examples needs to use binary mode

2010-01-28 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

In Section 20.23.3 Binary Objects of:
http://docs.python.org/3.1/library/xmlrpc.client.html

The server AND client examples fail because the read and write methods are not 
set to binary mode.

Example of what the client portion shows if you use the examples as is with 
Python 3.1.1 (r311:74483) on win32:

C:\Python31\python.exe example3_binary_obj_client.py
Traceback (most recent call last):
  File example3_binary_obj_client.py, line 10, in module
handle.write(proxy.python_logo().data)
  File C:\python31\lib\xmlrpc\client.py, line 1029, in __call__
return self.__send(self.__name, args)
  File C:\python31\lib\xmlrpc\client.py, line 1271, in __request
verbose=self.__verbose
  File C:\python31\lib\xmlrpc\client.py, line 1070, in request
return self.parse_response(resp)
  File C:\python31\lib\xmlrpc\client.py, line 1169, in parse_response
return u.close()
  File C:\python31\lib\xmlrpc\client.py, line 673, in close
raise Fault(**self._stack[0])
xmlrpc.client.Fault: Fault 1: class 'UnicodeDecodeError':'charmap' codec 
can't decode byte 0x81 in position 297: character maps to undefined

To fix it, the server example should have:

handle = open(python_logo.jpg, rb)

and the client example should have:

handle = open(fetched_python_logo.jpg, wb)

--
assignee: georg.brandl
components: Documentation
messages: 98488
nosy: georg.brandl, mnewman
severity: normal
status: open
title: xmlrpc.client binary object examples needs to use binary mode
versions: Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7801
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7802] socket.gaierror before ProtocolError for xmlrpc.client

2010-01-28 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

Following the example in Section 20.23.5. ProtocolError Objects of:
http://docs.python.org/3.1/library/xmlrpc.client.html
It implies that an invalid URL will give raise an xmlrpc.client.ProtocolError. 
Instead I'm getting a socket.gaierror instead. (I also tried using the google 
address to show tat ProtocolError is working correctly if a real URL is used, 
but doesn't offer XML-RPC services.) This similarly is happening for xmlrpclib 
on Python 2.6.

Is this a bug or documentation mistake?

Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)] on 
win32
Type help, copyright, credits or license for more information.
 import xmlrpc.client
 proxy = xmlrpc.client.ServerProxy(http://invalidaddress/;)
 proxy.some_method()
Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\python31\lib\xmlrpc\client.py, line 1029, in __call__
return self.__send(self.__name, args)
  File C:\python31\lib\xmlrpc\client.py, line 1271, in __request
verbose=self.__verbose
  File C:\python31\lib\xmlrpc\client.py, line 1058, in request
http_conn = self.send_request(host, handler, request_body, verbose)
  File C:\python31\lib\xmlrpc\client.py, line 1144, in send_request
connection.request(POST, handler, request_body, headers)
  File C:\python31\lib\http\client.py, line 918, in request
self._send_request(method, url, body, headers)
  File C:\python31\lib\http\client.py, line 956, in _send_request
self.endheaders(body)
  File C:\python31\lib\http\client.py, line 914, in endheaders
self._send_output(message_body)
  File C:\python31\lib\http\client.py, line 768, in _send_output
self.send(msg)
  File C:\python31\lib\http\client.py, line 716, in send
self.connect()
  File C:\python31\lib\http\client.py, line 698, in connect
self.timeout)
  File C:\python31\lib\socket.py, line 292, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno 11001] getaddrinfo failed
 proxy = xmlrpc.client.ServerProxy(http://www.google.com/;)
 proxy.some_method()
Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\python31\lib\xmlrpc\client.py, line 1029, in __call__
return self.__send(self.__name, args)
  File C:\python31\lib\xmlrpc\client.py, line 1271, in __request
verbose=self.__verbose
  File C:\python31\lib\xmlrpc\client.py, line 1065, in request
dict(resp.getheaders())
xmlrpc.client.ProtocolError: ProtocolError for www.google.com/: 405 Method Not 
Allowed


Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on 
win32
Type help, copyright, credits or license for more information.
 import xmlrpclib
 proxy = xmlrpclib.ServerProxy(http://invalidaddress/;)
 proxy.some_method()
Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\python26\lib\xmlrpclib.py, line 1199, in __call__
return self.__send(self.__name, args)
  File C:\python26\lib\xmlrpclib.py, line 1489, in __request
verbose=self.__verbose
  File C:\python26\lib\xmlrpclib.py, line 1235, in request
self.send_content(h, request_body)
  File C:\python26\lib\xmlrpclib.py, line 1349, in send_content
connection.endheaders()
  File C:\python26\lib\httplib.py, line 892, in endheaders
self._send_output()
  File C:\python26\lib\httplib.py, line 764, in _send_output
self.send(msg)
  File C:\python26\lib\httplib.py, line 723, in send
self.connect()
  File C:\python26\lib\httplib.py, line 704, in connect
self.timeout)
  File C:\python26\lib\socket.py, line 500, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno 11001] getaddrinfo failed
 proxy = xmlrpclib.ServerProxy(http://www.google.com/;)
 proxy.some_method()
Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\python26\lib\xmlrpclib.py, line 1199, in __call__
return self.__send(self.__name, args)
  File C:\python26\lib\xmlrpclib.py, line 1489, in __request
verbose=self.__verbose
  File C:\python26\lib\xmlrpclib.py, line 1243, in request
headers
xmlrpclib.ProtocolError: ProtocolError for www.google.com/: 405 Method Not 
Allowed

I also checked Python 3.1 on Linux:

Python 3.1.1 (r311:74480, Oct 18 2009, 19:21:53) [GCC 4.3.3] on linux2
Type help, copyright, credits or license for more information.
 import xmlrpc.client
 proxy = xmlrpc.client.ServerProxy(http://invalidaddress/;)
 proxy.some_method()
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/local/lib/python3.1/xmlrpc/client.py, line 1029, in __call__
return self.__send(self.__name, args)
  File /usr/local/lib/python3.1/xmlrpc/client.py, line 1271, in __request
verbose=self.__verbose
  File /usr/local/lib/python3.1/xmlrpc/client.py, line 1058, in request
http_conn = self.send_request(host, handler, request_body, verbose)
  File /usr/local/lib/python3.1/xmlrpc/client.py

[issue7761] telnetlib Telnet.interact fails on Windows but not Linux

2010-01-22 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

Telnet.interact() is failing on Python 3.1.1 Windows, but works fine on Python 
2.6.4 Windows and also works on Python 3.1.1 Linux. See 3 examples below:

--- Test #1 (fails): Telnet.interact on Python 3.1.1 Windows --- 

Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit (Intel)] on 
win32
Type help, copyright, credits or license for more information.
 from telnetlib import Telnet
 tn = Telnet(scn.org, 23)
 tn.interact()
Unhandled exception in thread started by bound method Telnet.listener of 
telnetlib.Telnet object at 0x00C3C3F0
Traceback (most recent call last):
  File C:\python31\lib\telnetlib.py, line 566, in listener
sys.stdout.write(data)
TypeError: must be str, not bytes
# (I press enter again):
Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\python31\lib\telnetlib.py, line 528, in interact
self.mt_interact()
  File C:\python31\lib\telnetlib.py, line 555, in mt_interact
self.write(line)
  File C:\python31\lib\telnetlib.py, line 277, in write
if IAC in buffer:
TypeError: 'in string' requires string as left operand, not bytes

--- Test #2 (works): Telnet.interact on Python 2.6.4 Windows ---

Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on
win32
Type help, copyright, credits or license for more information.
 from telnetlib import Telnet
 tn = Telnet(scn.org, 23)
 tn.interact()

Seattle Community Network Sun Solaris 1.1.1.B
Please login as 'visitor' if you are a visitor


SunOS UNIX (scn)

login:

--- Test #3 (works): Telnet.interact on Python 3.1.1 Linux ---

m...@ebx2009:~$ python3.1
Python 3.1.1 (r311:74480, Oct 18 2009, 19:21:53) 
[GCC 4.3.3] on linux2
Type help, copyright, credits or license for more information.
 from telnetlib import Telnet
 tn = Telnet(scn.org, 23)
 tn.interact()

Seattle Community Network Sun Solaris 1.1.1.B
Please login as 'visitor' if you are a visitor


SunOS UNIX (scn)

login:

--
components: Library (Lib), Windows
messages: 98174
nosy: mnewman
severity: normal
status: open
title: telnetlib Telnet.interact fails on Windows but not Linux
versions: Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7761
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7592] ssl module documentation: SSLSocket.unwrap description shown twice

2009-12-28 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

For the ssl module documentation at:
http://docs.python.org/3.1/library/ssl.html

I noticed that SSLSocket.unwrap() description is listed twice in the
17.3.2. SSLSocket Objects section.

--
assignee: georg.brandl
components: Documentation
messages: 96977
nosy: georg.brandl, mnewman
severity: normal
status: open
title: ssl module documentation: SSLSocket.unwrap description shown twice
versions: Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7592
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6417] multiprocessing Process examples: print and getppid

2009-07-04 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

The 16.6.1.1. The Process class section of the multiprocessing
documentation:
http://docs.python.org/dev/py3k/library/multiprocessing.html
has errors in both examples.

The first example needs the indentation fixed on the from and if
lines (remove the leading spaces).

The second example has two issues: print syntax needs be updated from
2.0 to 3.0 syntax. Also, getppid is not available on win32 platforms.
Below is a corrected example, which I tested successfully on on win32
and linux:

# Python 3.1 (r31:73574, Jun 26 2009, 20:21:35) [MSC v.1500 32 bit
(Intel)] on win32
C:\c:\Python31\python.exe Process_with_more_info.py
main line
module name: __main__
parent process: None
process id: 3216
function f
module name: __main__
parent process: 3216
process id: 3692
hello bob

# Python 3.0.1 (r301:69556, Jun  6 2009, 21:34:43) [GCC 4.3.2] on linux2
m...@www:~/files$ python3.0 Process_with_more_info.py
main line
module name: __main__
parent process: 19853
process id: 22544
function f
module name: __main__
parent process: 22544
process id: 22545
hello bob

# Start of corrected example:

from multiprocessing import Process, current_process
from sys import platform
import os

def info(title):
print(title)
print('module name:', __name__)
if platform == 'win32':
  print('parent process:', current_process()._parent_pid)
else:
  print('parent process:', os.getppid())
print('process id:', os.getpid())

def f(name):
info('function f')
print('hello', name)

if __name__ == '__main__':
info('main line')
p = Process(target=f, args=('bob',))
p.start()
p.join()

# End of corrected example.

I also saw this online:
os.getppid on Windows
http://d.hatena.ne.jp/chrono-meter/20090325/p1
But the license of the code is not clear, and it would make the example
too confusing to insert in.

Another reference:
Multiprocessing docs are not 3.0-ready
http://bugs.python.org/issue3256
Looks like some print statements fixed back then, but not sure why the
examples mentioned here were not fixed.

--
assignee: georg.brandl
components: Documentation
messages: 90118
nosy: georg.brandl, mnewman
severity: normal
status: open
title: multiprocessing Process examples: print and getppid
versions: Python 3.1

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6417
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6417] multiprocessing Process examples: print and getppid

2009-07-04 Thread Michael Newman

Michael Newman michael.b.new...@gmail.com added the comment:

# Revised example that is more platform neutral (avoids sys.platform):

from multiprocessing import Process, current_process
import os

def info(title):
print(title)
print('module name:', __name__)
if not hasattr(os, 'getppid'):  # win32
  print('parent process:', current_process()._parent_pid)
else:
  print('parent process:', os.getppid())
print('process id:', os.getpid())

def f(name):
info('function f')
print('hello', name)

if __name__ == '__main__':
info('main line')
p = Process(target=f, args=('bob',))
p.start()
p.join()

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6417
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4309] ctypes documentation

2009-06-08 Thread Michael Newman

Michael Newman michael.b.new...@gmail.com added the comment:

Watch out on Line 247 of r73293:
bytes objcet
should be:
bytes object

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4309
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4309] ctypes documentation

2009-06-06 Thread Michael Newman

Michael Newman michael.b.new...@gmail.com added the comment:

Regarding Section 15.15.1.5. Calling functions, continued on:
http://docs.python.org/3.0/library/ctypes.html

I would recommend changing the first example code block to the following:

 printf = libc.printf
 printf(bHello, %s\n, bWorld!)
Hello, World!
14
 printf(c_char_p(Hello, %s\n), c_char_p(World!))
Hello, World!
14
 printf(bHello, %S\n, World!)
Hello, World!
14
 printf(c_char_p(Hello, %S\n), World!)
Hello, World!
14
 printf(c_char_p(%d bottles of beer\n), 42)
42 bottles of beer
19
 printf(c_char_p(%f bottles of beer\n), 42.5)
Traceback (most recent call last):
  File stdin, line 1, in module
ctypes.ArgumentError: argument 2: class 'TypeError': Don't know how to
convert parameter 2

And change the second example block to:

 printf(c_char_p(An int %d, a double %f\n), 1234, c_double(3.14))
An int 1234, a double 3.14
31

Aside: For reference, here is how I started up the interactive session:
m...@www:~$ python3.0
Python 3.0.1 (r301:69556, Jun  6 2009, 21:34:43)
[GCC 4.3.2] on linux2
Type help, copyright, credits or license for more information.
 from ctypes import *
 libc = CDLL(libc.so.6)

Note the printf.argtypes method is discussed later in Section
15.15.1.7. Specifying the required argument types (function
prototypes), so it might be premature to use it here.

--
nosy: +mnewman

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4309
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue6155] logging example uses unavailable cPickle module

2009-05-31 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

The server portion of the example at:
15.6.9. Sending and receiving logging events across a network
http://docs.python.org/3.0/library/logging.html
uses import cPickle which is not available for Python 3.0.1

Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit
(Intel)] on win32
Type help, copyright, credits or license for more information.
 import cPickle
Traceback (most recent call last):
  File stdin, line 1, in module
ImportError: No module named cPickle

Alternatively, I tried to run the example from a script:
G:\Programming\python3\module_logging\SocketHandler_exampleserver.py
Traceback (most recent call last):
  File
G:\Programming\python3\module_logging\SocketHandler_example\server.py,
line 4, in module
import cPickle
ImportError: No module named cPickle

I fixed it by changing:
import cPickle to import pickle
and
return cPickle.loads(data) to return pickle.loads(data)

--
assignee: georg.brandl
components: Documentation
messages: 88599
nosy: georg.brandl, mnewman
severity: normal
status: open
title: logging example uses unavailable cPickle module
versions: Python 3.0

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue6155
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5758] fileinput.hook_compressed returning bytes from gz file

2009-04-14 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

The attached ZIP file contains test.bat which runs test.py with
Python 2.6 and Python 3.0.

Python 2.6 behaves as expected (see py26.out), since it returns
strings from both mike.txt and mike.txt.gz. However, the same test
with Python 3.0 returns bytes from mike.txt.gz, as shown in py30.out:
Output: Hello from Mike.
Output: This is the second line.
Output: Why did the robot cross the road?
Output: b'Hello from Mike.'
Output: b'This is the second line.'
Output: b'Why did the robot cross the road?'

For reference, I tested this on Python versions:
Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit
(Intel)] on win32
Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit
(Intel)] on win32

--
components: Library (Lib)
files: example.zip
messages: 85978
nosy: mnewman
severity: normal
status: open
title: fileinput.hook_compressed returning bytes from gz file
type: behavior
versions: Python 3.0
Added file: http://bugs.python.org/file13688/example.zip

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5758
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5595] os.path.ismount (ntpath) gives UnboundLocalError for any input

2009-03-29 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

os.path.ismount gives UnboundLocalError for any input in Python 3.0:

Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit
(Intel)] on win32
Type help, copyright, credits or license for more information.
 import os.path
 os.path
module 'ntpath' from 'C:\python30\lib\ntpath.py'
UnboundLocalError: local variable 'p' referenced before assignment
 os.path.ismount(C:\\)
Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\python30\lib\ntpath.py, line 260, in ismount
seps = _get_bothseps(p)
UnboundLocalError: local variable 'p' referenced before assignment
 os.path.ismount(C:\\windows)
Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\python30\lib\ntpath.py, line 260, in ismount
seps = _get_bothseps(p)
UnboundLocalError: local variable 'p' referenced before assignment

It works fine in Python 2.6:
Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit
(Intel)] on win32
Type help, copyright, credits or license for more information.
 import os.path
 os.path
module 'ntpath' from 'C:\python26\lib\ntpath.pyc'
 os.path.ismount(C:\\)
True
 os.path.ismount(C:\\windows)
False

--
components: Library (Lib)
messages: 84382
nosy: mnewman
severity: normal
status: open
title: os.path.ismount (ntpath) gives UnboundLocalError for any input
versions: Python 3.0

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5595
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5532] imap usage in itertools unique_justseen recipe

2009-03-21 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

The recipe for unique_justseen listed on:
http://docs.python.org/3.0/library/itertools.html
uses imap, which is not available in Python 3.0.

I fixed it by changing imap to just map, and I also changing
itemgetter to operator.itemgetter to make the namespace usage
clearer in the recipe:

Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit
(Intel)] on win32
Type help, copyright, credits or license for more information.
 from itertools import *
 import operator
 def unique_justseen(iterable, key=None):
... List unique elements, preserving order. Remember only the
element just
seen.
... # unique_justseen('BBBCCDAABBB') -- A B C D A B
... # unique_justseen('ABBCcAD', str.lower) -- A B C A D
... return map(next, map(operator.itemgetter(1), groupby(iterable,
key)))
...
 unique_justseen('BBBCCDAABBB')
map object at 0x00BB2690
 list(unique_justseen('BBBCCDAABBB'))
['A', 'B', 'C', 'D', 'A', 'B']
 unique_justseen('ABBCcAD', str.lower)
map object at 0x00BB2650
 list(unique_justseen('ABBCcAD', str.lower))
['A', 'B', 'C', 'A', 'D']


--
assignee: georg.brandl
components: Documentation
messages: 83943
nosy: georg.brandl, mnewman
severity: normal
status: open
title: imap usage in itertools unique_justseen recipe
versions: Python 3.0

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5532
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5393] cmath.cos and cmath.cosh have nResult typo in help

2009-02-28 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

cmath.cos and cmath.cosh have nResult typo in their help text.


Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit
(Intel)] on win32
Type help, copyright, credits or license for more information.
 import cmath
 help(cmath.cos)
Help on built-in function cos in module cmath:

cos(...)
cos(x)
nReturn the cosine of x.

 help(cmath.cosh)
Help on built-in function cosh in module cmath:

cosh(...)
cosh(x)
nReturn the hyperbolic cosine of x.


Likewise in Py26, Py25, and Py24...


Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit
(Intel)] on win32
Type help, copyright, credits or license for more information.
 import cmath
 help(cmath.cos)
Help on built-in function cos in module cmath:

cos(...)
cos(x)
nReturn the cosine of x.

 help(cmath.cosh)
Help on built-in function cosh in module cmath:

cosh(...)
cosh(x)
nReturn the hyperbolic cosine of x.



Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit
(Intel)] on win32
Type help, copyright, credits or license for more information.
 import cmath
 help(cmath.cos)
Help on built-in function cos in module cmath:

cos(...)
cos(x)
nReturn the cosine of x.

 help(cmath.cosh)
Help on built-in function cosh in module cmath:

cosh(...)
cosh(x)
nReturn the hyperbolic cosine of x.



Python 2.4.4 (#71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on
win32
Type help, copyright, credits or license for more information.
 import cmath
 help(cmath.cos)
Help on built-in function cos in module cmath:

cos(...)
cos(x)
nReturn the cosine of x.

 help(cmath.cosh)
Help on built-in function cosh in module cmath:

cosh(...)
cosh(x)
nReturn the hyperbolic cosine of x.


--
assignee: georg.brandl
components: Documentation
messages: 82915
nosy: georg.brandl, mnewman
severity: normal
status: open
title: cmath.cos and cmath.cosh have nResult typo in help
versions: Python 2.4, Python 2.5, Python 2.6, Python 3.0

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5393
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5086] set_daemon does not exist in Thread

2009-01-27 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

This is related to:
http://bugs.python.org/issue3628
http://bugs.python.org/issue4808

I found in the example at the bottom of:
http://docs.python.org/3.0/library/queue.html
t.set_daemon(True)
won't work.

Python 3.0 (r30:67507, Dec  3 2008, 20:14:27) [MSC v.1500 32 bit
(Intel)] on win32
Type help, copyright, credits or license for more information.
 from threading import Thread
 t = Thread()
 dir(t)
['_Thread__exc_info', '_Thread__initialized', '__class__',
'__delattr__', '__dic
t__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__',
'__gt__',
 '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__',
'__new__',
'__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__',
'__str__
', '__subclasshook__', '__weakref__', '_args', '_block', '_bootstrap',
'_bootstr
ap_inner', '_daemonic', '_delete', '_ident', '_initialized', '_kwargs',
'_name',
 '_note', '_set_daemon', '_started', '_stderr', '_stop', '_stopped',
'_target',
'_verbose', 'daemon', 'getName', 'ident', 'isAlive', 'isDaemon',
'is_alive', 'jo
in', 'name', 'run', 'setDaemon', 'setName', 'start']
 t.set_daemon(True)
Traceback (most recent call last):
  File stdin, line 1, in module
AttributeError: 'Thread' object has no attribute 'set_daemon'
 t.daemon
False
# This appears to be the proper method, unless set_daemon gets added
in (or setDaemon is used, but that appears to be depreciated syntax):
 t.daemon = True
 t.daemon
True

Please see the attached queue_join.py for my own working example. It
would be helpful to include the line:
 from threading import Thread
in the official example.

--
assignee: georg.brandl
components: Documentation
files: queue_join.py
messages: 80685
nosy: georg.brandl, mnewman
severity: normal
status: open
title: set_daemon does not exist in Thread
versions: Python 3.0
Added file: http://bugs.python.org/file12883/queue_join.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5086
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5087] set_daemon does not exist in Thread

2009-01-27 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

This is related to:
http://bugs.python.org/issue3628
http://bugs.python.org/issue4808

I found in the example at the bottom of:
http://docs.python.org/3.0/library/queue.html
t.set_daemon(True)
won't work.

Python 3.0 (r30:67507, Dec  3 2008, 20:14:27) [MSC v.1500 32 bit
(Intel)] on win32
Type help, copyright, credits or license for more information.
 from threading import Thread
 t = Thread()
 dir(t)
['_Thread__exc_info', '_Thread__initialized', '__class__',
'__delattr__', '__dic
t__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__',
'__gt__',
 '__hash__', '__init__', '__le__', '__lt__', '__module__', '__ne__',
'__new__',
'__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__',
'__str__
', '__subclasshook__', '__weakref__', '_args', '_block', '_bootstrap',
'_bootstr
ap_inner', '_daemonic', '_delete', '_ident', '_initialized', '_kwargs',
'_name',
 '_note', '_set_daemon', '_started', '_stderr', '_stop', '_stopped',
'_target',
'_verbose', 'daemon', 'getName', 'ident', 'isAlive', 'isDaemon',
'is_alive', 'jo
in', 'name', 'run', 'setDaemon', 'setName', 'start']
 t.set_daemon(True)
Traceback (most recent call last):
  File stdin, line 1, in module
AttributeError: 'Thread' object has no attribute 'set_daemon'
 t.daemon
False
# This appears to be the proper method, unless set_daemon gets added
in (or setDaemon is used, but that appears to be depreciated syntax):
 t.daemon = True
 t.daemon
True

Please see the attached queue_join.py for my own working example. It
would be helpful to include the line:
 from threading import Thread
in the official example.

--
assignee: georg.brandl
components: Documentation
files: queue_join.py
messages: 80686
nosy: georg.brandl, mnewman
severity: normal
status: open
title: set_daemon does not exist in Thread
versions: Python 3.0
Added file: http://bugs.python.org/file12884/queue_join.py

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5087
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4973] calendar formatyearpage returns bytes, not str

2009-01-18 Thread Michael Newman

Michael Newman michael.b.new...@gmail.com added the comment:

It seems to be working consistently (see UTF-16 extreme example below),
but I had expected it to act similarly to Python 2.6, which it does not.
I suppose this is due to the distinction now made between strings and
bytes in Python 3.0.

I was initially concerned that Python 3.0 was always just giving an
ASCII byte stream no matter what encoding was chosen (since you can't
tell between ASCII and UTF-8 for the characters being used in the
example), but the UTF-16 example shows its fine.

I agree that as long as the documentation in Python 3.X notes it will
return bytes, then its fine. Thanks for the clarification/confirmation.

Python 3.0 (r30:67507, Dec  3 2008, 20:14:27) [MSC v.1500 32 bit
(Intel)] on win32
Type help, copyright, credits or license for more information.
 import calendar
 calendar.HTMLCalendar().formatyearpage(2009, encoding=utf-8)[0:50]
b'?xml version=1.0 encoding=utf-8?\n!DOCTYPE h'
 calendar.HTMLCalendar().formatyearpage(2009, encoding=ascii)[0:50]
b'?xml version=1.0 encoding=ascii?\n!DOCTYPE h'
 calendar.HTMLCalendar().formatyearpage(2009, encoding=utf-16)[0:50]
b'\xff\xfe\x00?\x00x\x00m\x00l\x00
\x00v\x00e\x00r\x00s\x00i\x00o\x00n\x00=\x00\x001\x00.\x000\x00\x00
\x00e\x00n\x00c\x00o\x00'

Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit
(Intel)] on win32
Type help, copyright, credits or license for more information.
 import calendar
 calendar.HTMLCalendar().formatyearpage(2009, encoding=utf-8)[0:50]
'?xml version=1.0 encoding=utf-8?\n!DOCTYPE h'
 calendar.HTMLCalendar().formatyearpage(2009, encoding=ascii)[0:50]
'?xml version=1.0 encoding=ascii?\n!DOCTYPE h'
 calendar.HTMLCalendar().formatyearpage(2009, encoding=utf-16)[0:50]
'\xff\xfe\x00?\x00x\x00m\x00l\x00
\x00v\x00e\x00r\x00s\x00i\x00o\x00n\x00=\x00\x001\x00.\x000\x00\x00
\x00e\x00n\x00c\x00o\x00'

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4973
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4973] calendar formatyearpage returns bytes, not str

2009-01-17 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

formatyearpage is returning bytes, not str

Python 3.0 (r30:67507, Dec  3 2008, 20:14:27) [MSC v.1500 32 bit
(Intel)] on win
32
Type help, copyright, credits or license for more information.
 import calendar
 calendar.HTMLCalendar().formatyearpage(2009)[0:50]
b'?xml version=1.0 encoding=utf-8?\n!DOCTYPE h'
 type(calendar.HTMLCalendar().formatyearpage(2009)[0:50])
class 'bytes'

# For the time being, to fix it I can use decode...
 calendar.HTMLCalendar().formatyearpage(2009).decode(utf-8)[0:50]
'?xml version=1.0 encoding=utf-8?\n!DOCTYPE h'
 type(calendar.HTMLCalendar().formatyearpage(2009).decode(utf-8)[0:50])
class 'str'

--
components: Extension Modules
messages: 80030
nosy: mnewman
severity: normal
status: open
title: calendar formatyearpage returns bytes, not str
versions: Python 3.0

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4973
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4700] UnicodeEncodeError in license()

2008-12-19 Thread Michael Newman

New submission from Michael Newman michael.b.new...@gmail.com:

UnicodeEncodeError occurs for Microsoft portion of license().
Confirmed on 3 separate Windows XP computers:

Python 3.0 (r30:67507, Dec  3 2008, 20:14:27) [MSC v.1500 32 bit
(Intel)] on win32
Type help, copyright, credits or license for more information.
 license()
A. HISTORY OF THE SOFTWARE
==

Python was created in the early 1990s by Guido van Rossum at Stichting
Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands
as a successor of a language called ABC.  Guido remains Python's

... skipping to end ...

distribution specified by Microsoft. In particular, you must require
distributors and external end users to agree to terms that protect the
Microsoft Distributable Code at least as much as Microsoft's own
requirements for the Distributable Code. See Microsoft's documentation
(included in its developer tools and on its website at microsoft.com)
for specific details.

Redistribution of the Windows binary build of the Python interpreter
complies with this agreement, provided that you do not:

- alter any copyright, trademark or patent notice in Microsoft's
Hit Return for more, or q (and Return) to quit:
Distributable Code;

Traceback (most recent call last):
  File stdin, line 1, in module
  File C:\Python30\lib\site.py, line 385, in __call__
print(self.__lines[i])
  File C:\Python30\lib\io.py, line 1491, in write
b = encoder.encode(s)
  File C:\Python30\lib\encodings\cp437.py, line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2019' in
position
15: character maps to undefined

--
components: Windows
messages: 78057
nosy: mnewman
severity: normal
status: open
title: UnicodeEncodeError in license()
type: crash
versions: Python 3.0

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4700
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com