Re: How to have python 2 and 3 both on windows?

2022-04-24 Thread Eryk Sun
On 4/23/22, Sunil KR via Python-list wrote: > > I am happy with how the python starts up. When I use python I get > python 2. I am ok with using py -3 for my new scripts, even using the > shebang like #!py -3 `#!py -3` is not a valid shebang for the py launcher. Use `#!python3` to run a script

Re: How to have python 2 and 3 both on windows?

2022-04-24 Thread Peter J. Holzer
On 2022-04-24 01:19:38 +, Sunil KR via Python-list wrote: > But the real question/s for me is/are > > -- Why are my strings being sent to python3, so that I get the unicode > related error? You haven't shown us how you invoke those scripts, so we can't answer that question with the

Re: How to have python 2 and 3 both on windows?

2022-04-24 Thread Sunil KR via Python-list
tion. If you have any print statements that do not have ( ) surrounding the output items, it WILL fail in Python3. >In my case, I don't own the python2 scripts and so I am not allowed to change >any part of them. And I wouldn't need to either, if I can make python 2 and 3 >coexist on

Re: How to have python 2 and 3 both on windows?

2022-04-23 Thread Dennis Lee Bieber
ange >any part of them. And I wouldn't need to either, if I can make python 2 and 3 >coexist on my system > Even if you are not "allowed to change" those scripts, have you tried feeding them through the 2to3 conversion script just to see what type of changes would be required?

Re: How to have python 2 and 3 both on windows?

2022-04-23 Thread Sunil KR via Python-list
python 2 and 3 coexist on my system > On 22 Apr 2022, at 17:10, Sunil KR via Python-list wrote: > > I have some scripts that are old and won't work under python2 and at the > same time I am writing new scripts which will use python3. However, if python > 2 and 3

Re: How to have python 2 and 3 both on windows?

2022-04-22 Thread Barry
> On 22 Apr 2022, at 18:43, Gisle Vanem wrote: > > Barry wrote: > >> Tip “py.exe -0” will list the state of installed pythons. > Not here; 'py.exe -0' gives: > Requested Python version (0) not installed > > Which PyInstaller version support this '-0' option? I do not when it was first

Re: How to have python 2 and 3 both on windows?

2022-04-22 Thread Mats Wichmann
On 4/22/22 11:40, Gisle Vanem wrote: > Barry wrote: > >> Tip “py.exe -0” will list the state of installed pythons. > Not here; 'py.exe -0' gives: >   Requested Python version (0) not installed > > Which PyInstaller version support this '-0' option? > Looks like this got added around 3.7...

Re: How to have python 2 and 3 both on windows?

2022-04-22 Thread Gisle Vanem
Barry wrote: Tip “py.exe -0” will list the state of installed pythons. Not here; 'py.exe -0' gives: Requested Python version (0) not installed Which PyInstaller version support this '-0' option? -- --gv -- https://mail.python.org/mailman/listinfo/python-list

Re: How to have python 2 and 3 both on windows?

2022-04-22 Thread Sunil KR via Python-list
riday, April 22, 2022, 09:09:22 AM PDT, Sunil KR via Python-list wrote: I have some scripts that are old and won't work under python2 and at the same time I am writing new scripts which will use python3. However, if python 2 and 3 cannot co-exist in a windows box it will be impossible to tr

Re: How to have python 2 and 3 both on windows?

2022-04-22 Thread Barry
> On 22 Apr 2022, at 17:10, Sunil KR via Python-list > wrote: > > I have some scripts that are old and won't work under python2 and at the > same time I am writing new scripts which will use python3. However, if python > 2 and 3 cannot co-exist in a windows box it

How to have python 2 and 3 both on windows?

2022-04-22 Thread Sunil KR via Python-list
I have some scripts that are old and won't work under python2 and at the same time I am writing new scripts which will use python3. However, if python 2 and 3 cannot co-exist in a windows box it will be impossible to transition What I try:- remove all pythons and launchers- Use windows installer

[issue23556] [doc] Scope for raise without argument is different in Python 2 and 3

2022-01-27 Thread Irit Katriel
Irit Katriel added the comment: Thank you @a3nm, @kinshukdua2 and @martin.panter. -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker

[issue23556] [doc] Scope for raise without argument is different in Python 2 and 3

2022-01-27 Thread miss-islington
miss-islington added the comment: New changeset 2572c670d42887e4b1d2475b8da2e9bf6e0aa558 by Miss Islington (bot) in branch '3.10': [3.10] bpo-23556: [doc] Fix inaccuracy in documentation for raise without args. Improve tests for context in nested except handlers. (GH-29236) (GH-30953)

[issue23556] [doc] Scope for raise without argument is different in Python 2 and 3

2022-01-27 Thread miss-islington
miss-islington added the comment: New changeset 1440dd343871645c187028916dd6ee97300d2557 by Miss Islington (bot) in branch '3.9': bpo-23556: [doc] Fix inaccuracy in documentation for raise without args. Improve tests for context in nested except handlers. (GH-29236)

[issue23556] [doc] Scope for raise without argument is different in Python 2 and 3

2022-01-27 Thread Irit Katriel
Irit Katriel added the comment: New changeset 08c0ed2d9c0d01ad1a5adc0787bc75e4e90cbb85 by Kinshuk Dua in branch 'main': bpo-23556: [doc] Fix inaccuracy in documentation for raise without args. Improve tests for context in nested except handlers. (GH-29236)

[issue23556] [doc] Scope for raise without argument is different in Python 2 and 3

2022-01-27 Thread miss-islington
Change by miss-islington : -- pull_requests: +29133 pull_request: https://github.com/python/cpython/pull/30954 ___ Python tracker ___

[issue23556] [doc] Scope for raise without argument is different in Python 2 and 3

2022-01-27 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 9.0 -> 10.0 pull_requests: +29132 pull_request: https://github.com/python/cpython/pull/30953 ___ Python tracker

[issue23556] [doc] Scope for raise without argument is different in Python 2 and 3

2022-01-26 Thread Kinshuk Dua
Kinshuk Dua added the comment: @iritkatriel I thought the PR won't be reviewed after being marked as stale that's why I closed it. I've reopened it and I'm interested in finishing it. -- nosy: +kinshukdua2 ___ Python tracker

[issue23556] [doc] Scope for raise without argument is different in Python 2 and 3

2022-01-25 Thread Irit Katriel
Irit Katriel added the comment: @kinshukdua - can you explain why you closed the PR and whether you are interested in reopening it and finishing this? -- ___ Python tracker

[issue23556] [doc] Scope for raise without argument is different in Python 2 and 3

2021-10-27 Thread Kinshuk Dua
Change by Kinshuk Dua : -- keywords: +patch nosy: +kinshukdua nosy_count: 7.0 -> 8.0 pull_requests: +27499 pull_request: https://github.com/python/cpython/pull/29236 ___ Python tracker

[issue23556] [doc] Scope for raise without argument is different in Python 2 and 3

2021-10-25 Thread Irit Katriel
Irit Katriel added the comment: Martin's patch needs to be converted to a GitHub PR and then reviewed. -- keywords: +easy -patch nosy: +iritkatriel title: Scope for raise without argument is different in Python 2 and 3 -> [doc] Scope for raise without argument is different in Pyt

[issue32915] Running Python 2 with -3 flag doesn't complain about cmp/__cmp__

2021-05-30 Thread Raymond Hettinger
Change by Raymond Hettinger : -- stage: -> resolved status: pending -> closed ___ Python tracker ___ ___ Python-bugs-list mailing

[issue32915] Running Python 2 with -3 flag doesn't complain about cmp/__cmp__

2021-05-28 Thread Irit Katriel
Irit Katriel added the comment: We're not going to make changes in python 2 anymore, so this can be closed, right? -- nosy: +iritkatriel resolution: -> out of date status: open -> pending ___ Python tracker

[issue34145] uuid3 and uuid5 hard to use portably between Python 2 and 3

2020-01-19 Thread Zachary Ware
Zachary Ware added the comment: Python 2.7 has reached EOL, and so this change can no longer be made. Thanks for the idea report and idea anyway, Bence! -- nosy: +zach.ware resolution: -> out of date stage: patch review -> resolved status: open -> closed versions: -Python 3.6

Re: python 2 to 3 converter

2019-12-10 Thread Chris Angelico
On Wed, Dec 11, 2019 at 1:57 AM songbird wrote: > > Chris Angelico wrote: > > On Tue, Dec 10, 2019 at 12:15 PM songbird wrote: > >> > >> Chris Angelico wrote: > >> ... > >> > > >> > Here's an example piece of code. > >> > > >> > sock = socket.socket(...) > >> > name = input("Enter your username:

Re: python 2 to 3 converter

2019-12-10 Thread songbird
n done it manually, I mean. It's very difficult to try to > design an AI to do something that you can't do yourself and don't even > understand the problem. for me it would be a way of learning python 2 and python 3 better. i have enough understanding of how compilers work so those parts o

Re: python 2 to 3 converter

2019-12-10 Thread songbird
Chris Angelico wrote: > On Tue, Dec 10, 2019 at 12:15 PM songbird wrote: >> >> Chris Angelico wrote: >> ... >> > >> > Here's an example piece of code. >> > >> > sock = socket.socket(...) >> > name = input("Enter your username: ") >> > code = input("Enter the base64 code: ") >> > code =

Re: python 2 to 3 converter

2019-12-09 Thread Chris Angelico
On Tue, Dec 10, 2019 at 4:41 PM songbird wrote: > > Chris Angelico wrote: > ... > > What if neither works, because there are assumptions that don't work? > > then you get stuck doing it by hand, but you would have > been stuck doing it before for sure by hand so if you can > write something

Re: python 2 to 3 converter

2019-12-09 Thread songbird
Chris Angelico wrote: ... > What if neither works, because there are assumptions that don't work? then you get stuck doing it by hand, but you would have been stuck doing it before for sure by hand so if you can write something which might get some of the easy cases done then at least you're

Re: python 2 to 3 converter

2019-12-09 Thread Chris Angelico
On Tue, Dec 10, 2019 at 12:15 PM songbird wrote: > > Chris Angelico wrote: > ... > > > > Here's an example piece of code. > > > > sock = socket.socket(...) > > name = input("Enter your username: ") > > code = input("Enter the base64 code: ") > > code = base64.b64decode(code) > > sock.write("""GET

Re: python 2 to 3 converter

2019-12-09 Thread Chris Angelico
On Tue, Dec 10, 2019 at 12:11 PM songbird wrote: > > Rob Gaddi wrote: > ... > > And how exactly do you propose to determine whether the constant I've > > enclosed > > in quotation marks in Python2 represents "text" or "binary data"? Not all > > text > > is words; think of SQL queries. And

Re: python 2 to 3 converter

2019-12-09 Thread songbird
Chris Angelico wrote: ... > > Here's an example piece of code. > > sock = socket.socket(...) > name = input("Enter your username: ") > code = input("Enter the base64 code: ") > code = base64.b64decode(code) > sock.write("""GET /foo HTTP/1.0 > Authentication: Demo %s/%s > > """ % (name, code)) >

Re: python 2 to 3 converter

2019-12-09 Thread songbird
Rob Gaddi wrote: ... > And how exactly do you propose to determine whether the constant I've > enclosed > in quotation marks in Python2 represents "text" or "binary data"? Not all > text > is words; think of SQL queries. And some words are binary data, think SCPI > commands being sent to a

Re: python 2 to 3 converter

2019-12-09 Thread Rob Gaddi
On 12/9/19 9:55 AM, songbird wrote: jf...@ms4.hinet.net wrote: ... Even string is hard to be handled by the AI:-) Quoted from https://portingguide.readthedocs.io/en/latest/strings.html " ... This means that you need to go through the entire codebase, and decide which value is what type.

Re: python 2 to 3 converter

2019-12-09 Thread Chris Angelico
On Tue, Dec 10, 2019 at 5:05 AM songbird wrote: > > jf...@ms4.hinet.net wrote: > ... > > Even string is hard to be handled by the AI:-) > > > > Quoted from https://portingguide.readthedocs.io/en/latest/strings.html > > " ... This means that you need to go through the entire codebase, and > >

Re: python 2 to 3 converter

2019-12-09 Thread songbird
jf...@ms4.hinet.net wrote: ... > Even string is hard to be handled by the AI:-) > > Quoted from https://portingguide.readthedocs.io/en/latest/strings.html > " ... This means that you need to go through the entire codebase, and decide > which value is what type. Unfortunately, this process

Re: python 2 to 3 converter

2019-12-09 Thread songbird
Greg Ewing wrote: > On 8/12/19 9:30 pm, songbird wrote: >>wouldn't it make more sense to just go back and fix the >> converter program than to have to manually convert all this >> python2 code? > > Anything that isn't already fixed by 2to3 is probably > somewhere between very difficult and

Re: python 2 to 3 converter

2019-12-08 Thread jfong
Greg Ewing於 2019年12月9日星期一 UTC+8上午6時18分32秒寫道: > On 8/12/19 9:30 pm, songbird wrote: > >wouldn't it make more sense to just go back and fix the > > converter program than to have to manually convert all this > > python2 code? > > Anything that isn't already fixed by 2to3 is probably > somewhere

Re: python 2 to 3 converter

2019-12-08 Thread Greg Ewing
On 8/12/19 9:30 pm, songbird wrote: wouldn't it make more sense to just go back and fix the converter program than to have to manually convert all this python2 code? Anything that isn't already fixed by 2to3 is probably somewhere between very difficult and impossible to fix using an

Re: python 2 to 3 converter

2019-12-08 Thread songbird
Chris Angelico wrote: > On Sun, Dec 8, 2019 at 7:36 PM songbird wrote: >> this would be a heck of a lot of fun. > > Then go ahead and do it. i know you're just being flip here and that's fine with me. that said, i'd love to! how big is PyPI? (huge) will it fit on an SSD? (no) my local

Re: python 2 to 3 converter

2019-12-08 Thread Chris Angelico
On Sun, Dec 8, 2019 at 7:36 PM songbird wrote: > this would be a heck of a lot of fun. Then go ahead and do it. ChrisA -- https://mail.python.org/mailman/listinfo/python-list

python 2 to 3 converter

2019-12-08 Thread songbird
wouldn't it make more sense to just go back and fix the converter program than to have to manually convert all this python2 code? how many small test bits of code from PyPI could be used as templates for patterns to search for that can then be automatically converted and the test rerun?

Re: python 2 to 3 conversion

2019-06-17 Thread Igor Korot
, Jun 17, 2019 at 10:50 PM Thomas Jollans wrote: > > > > > > > > On 17/06/2019 15.14, Igor Korot wrote: > > > > > Hi, > > > > > Is there a place where there is a full list of incompatibilities > > > > > between > > > > > python 2 and

Re: python 2 to 3 conversion

2019-06-17 Thread Chris Angelico
> > > > Hi, > > > > Is there a place where there is a full list of incompatibilities between > > > > python 2 and python 3 is available and how to fix them? > > > > > > ‘What’s new in Python 3.0’ is a good starting point > > > > > >

Re: python 2 to 3 conversion

2019-06-17 Thread Grant Edwards
On 2019-06-17, Igor Korot wrote: > So, how do I write the code compatible with both python 2 and python 3 > in this case? Writing 2/3 compatible code that deals with bytes is difficult. For example: Python 2.7.15 (default, Sep 12 2018, 15:19:18) >>> bytes(5) '5'

Re: python 2 to 3 conversion

2019-06-17 Thread Igor Korot
Hi, Chris et al, On Mon, Jun 17, 2019 at 8:00 AM Chris Angelico wrote: > > On Mon, Jun 17, 2019 at 10:50 PM Thomas Jollans wrote: > > > > On 17/06/2019 15.14, Igor Korot wrote: > > > Hi, > > > Is there a place where there is a full list of incompatibilities

Re: python 2 to 3 conversion

2019-06-17 Thread Chris Angelico
On Mon, Jun 17, 2019 at 10:50 PM Thomas Jollans wrote: > > On 17/06/2019 15.14, Igor Korot wrote: > > Hi, > > Is there a place where there is a full list of incompatibilities between > > python 2 and python 3 is available and how to fix them? > > ‘What’s new in

Re: python 2 to 3 conversion

2019-06-17 Thread Chris Angelico
ll list of incompatibilities between > > > python 2 and python 3 is available and how to fix them? > > > > > > I'm looking for a way to fix following code, which runs perfectly with > > > python 2 > > > (and make it work with both python 2 and python 3): &g

Re: python 2 to 3 conversion

2019-06-17 Thread Thomas Jollans
On 17/06/2019 15.14, Igor Korot wrote: > Hi, > Is there a place where there is a full list of incompatibilities between > python 2 and python 3 is available and how to fix them? ‘What’s new in Python 3.0’ is a good starting point https://docs.python.org/3/whatsnew/3.0.html It doesn’t

Re: python 2 to 3 conversion

2019-06-17 Thread Igor Korot
Hi, Chris, On Mon, Jun 17, 2019 at 7:31 AM Chris Angelico wrote: > > On Mon, Jun 17, 2019 at 10:15 PM Igor Korot wrote: > > > > Hi, > > Is there a place where there is a full list of incompatibilities between > > python 2 and python 3 is available and how to

Re: python 2 to 3 conversion

2019-06-17 Thread Chris Angelico
On Mon, Jun 17, 2019 at 10:15 PM Igor Korot wrote: > > Hi, > Is there a place where there is a full list of incompatibilities between > python 2 and python 3 is available and how to fix them? > > I'm looking for a way to fix following code, which runs perfectly with pytho

python 2 to 3 conversion

2019-06-17 Thread Igor Korot
Hi, Is there a place where there is a full list of incompatibilities between python 2 and python 3 is available and how to fix them? I'm looking for a way to fix following code, which runs perfectly with python 2 (and make it work with both python 2 and python 3): if bytes[0:16].tostring

[issue34145] uuid3 and uuid5 hard to use portably between Python 2 and 3

2018-10-25 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34145] uuid3 and uuid5 hard to use portably between Python 2 and 3

2018-10-25 Thread Braden Groom
Change by Braden Groom : -- keywords: +patch pull_requests: +9433 stage: -> patch review ___ Python tracker ___ ___

[issue32915] Running Python 2 with -3 flag doesn't complain about cmp/__cmp__

2018-09-23 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +xtreak ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue34145] uuid3 and uuid5 hard to use portably between Python 2 and 3

2018-07-18 Thread Bence Romsics
New submission from Bence Romsics : The issue I'd like to report may not be an outright bug neither in cPython 2 nor in cPython 3, but more of a wishlist item to help Python programmers writing UUID-handling code that's valid in Python 2 and 3 at the same time. Please consider these one

[issue32915] Running Python 2 with -3 flag doesn't complain about cmp/__cmp__

2018-05-06 Thread Stefan Behnel
Stefan Behnel added the comment: > cmp(a,b) can be replaced with (a>b)-(a b" and "a < b" both return something that supports the minus operator, such as a boolean value. That might not be the case, and it is definitely impossible to infer

[issue32915] Running Python 2 with -3 flag doesn't complain about cmp/__cmp__

2018-05-06 Thread Ayush
Ayush added the comment: I believe 2to3 should be able to replicate the same results of cmp function in python 3 too. I can create a PR which will allow the library to handle it. For example, a function call cmp(a,b) can be replaced with (a>b)-(a

[issue32915] Running Python 2 with -3 flag doesn't complain about cmp/__cmp__

2018-02-23 Thread Ned Deily
Change by Ned Deily : -- nosy: +benjamin.peterson ___ Python tracker ___ ___

[issue32915] Running Python 2 with -3 flag doesn't complain about cmp/__cmp__

2018-02-23 Thread Raymond Hettinger
Raymond Hettinger added the comment: The stated goal of -3 is "warn about Python 3.x incompatibilities that 2to3 cannot trivially fix", so this use case seems like a good match. On the other hand, adding this to -3 would be somewhat noisy since __cmp__ is

[issue32915] Running Python 2 with -3 flag doesn't complain about cmp/__cmp__

2018-02-22 Thread Trey Hunner
: trey priority: normal severity: normal status: open title: Running Python 2 with -3 flag doesn't complain about cmp/__cmp__ versions: Python 2.7 Added file: https://bugs.python.org/file47459/caseless.py ___ Python tracker <rep...@bugs.python.or

Re: Python 2 to 3 Conversion

2018-02-19 Thread Chris Angelico
On Tue, Feb 20, 2018 at 12:05 PM, Wildman via Python-list wrote: > On Tue, 20 Feb 2018 10:55:28 +1100, Chris Angelico wrote: > >> The given homepage URL is >> http://alastairs-place.net/projects/netifaces/ - is that the right >> one? >> >> ChrisA > > Yes, that is the right

Re: Python 2 to 3 Conversion

2018-02-19 Thread Wildman via Python-list
On Tue, 20 Feb 2018 10:55:28 +1100, Chris Angelico wrote: > The given homepage URL is > http://alastairs-place.net/projects/netifaces/ - is that the right > one? > > ChrisA Yes, that is the right one. Now I'm feeling a little stupid. I should have remembered that many python library package

Re: Python 2 to 3 Conversion

2018-02-19 Thread Chris Angelico
On Tue, Feb 20, 2018 at 10:09 AM, Wildman via Python-list wrote: > Yes, you are correct. Third-party pip packages are always > a no-no. > > Speaking of which, there is a library called Netifaces that > will easily do exactly what I want with a few lines of code. > But, it

Re: Python 2 to 3 Conversion

2018-02-19 Thread Wildman via Python-list
On Tue, 20 Feb 2018 05:31:27 +1100, Chris Angelico wrote: > On Tue, Feb 20, 2018 at 3:49 AM, Wildman via Python-list > wrote: >> On Mon, 19 Feb 2018 12:32:49 +, Rhodri James wrote: >> >>> On 18/02/18 16:18, Wildman via Python-list wrote: > But that's only going to

Re: Python 2 to 3 Conversion

2018-02-19 Thread Wildman via Python-list
On Tue, 20 Feb 2018 05:39:15 +1100, Chris Angelico wrote: > On Tue, Feb 20, 2018 at 3:53 AM, Wildman via Python-list > wrote: >> On Tue, 20 Feb 2018 02:26:19 +1100, Chris Angelico wrote: >> >>> * Opaque IOCTLs >> >> Would you mind to elaborate a little about your >>

Re: Python 2 to 3 Conversion

2018-02-19 Thread Chris Angelico
On Tue, Feb 20, 2018 at 3:53 AM, Wildman via Python-list wrote: > On Tue, 20 Feb 2018 02:26:19 +1100, Chris Angelico wrote: > >> * Opaque IOCTLs > > Would you mind to elaborate a little about your > concerns? Look at your original code: it's impossible to figure out what

Re: Python 2 to 3 Conversion

2018-02-19 Thread Chris Angelico
On Tue, Feb 20, 2018 at 3:49 AM, Wildman via Python-list wrote: > On Mon, 19 Feb 2018 12:32:49 +, Rhodri James wrote: > >> On 18/02/18 16:18, Wildman via Python-list wrote: But that's only going to show one (uplink) address. If I needed to get ALL addresses

Re: Python 2 to 3 Conversion

2018-02-19 Thread Wildman via Python-list
On Tue, 20 Feb 2018 02:26:19 +1100, Chris Angelico wrote: > * Opaque IOCTLs Would you mind to elaborate a little about your concerns? -- GNU/Linux user #557453 "There are only 10 types of people in the world... those who understand Binary... and those who don't." -Spike --

Re: Python 2 to 3 Conversion

2018-02-19 Thread Wildman via Python-list
On Mon, 19 Feb 2018 12:32:49 +, Rhodri James wrote: > On 18/02/18 16:18, Wildman via Python-list wrote: >>> But that's only going to show one (uplink) address. If I needed to get >>> ALL addresses for ALL network adapters, I'd either look for a library, >>> and if one wasn't easily found, I'd

Re: Python 2 to 3 Conversion

2018-02-19 Thread Chris Angelico
On Mon, Feb 19, 2018 at 11:32 PM, Rhodri James wrote: > On 18/02/18 16:18, Wildman via Python-list wrote: >>> >>> But that's only going to show one (uplink) address. If I needed to get >>> ALL addresses for ALL network adapters, I'd either look for a library, >>> and if one

Re: Python 2 to 3 Conversion

2018-02-19 Thread Rhodri James
On 18/02/18 16:18, Wildman via Python-list wrote: But that's only going to show one (uplink) address. If I needed to get ALL addresses for ALL network adapters, I'd either look for a library, and if one wasn't easily found, I'd shell out to the "ip" command and parse its output.:) I considered

Re: Python 2 to 3 Conversion

2018-02-18 Thread Wildman via Python-list
On Sun, 18 Feb 2018 20:51:18 +1100, Chris Angelico wrote: > On Sun, Feb 18, 2018 at 4:35 AM, Wildman via Python-list > wrote: >> Thanks to Chris and Ben. Your suggestions were slightly >> different but both worked equally well, although I don't >> understand how that can

Re: Python 2 to 3 Conversion

2018-02-18 Thread Chris Angelico
On Sun, Feb 18, 2018 at 4:35 AM, Wildman via Python-list wrote: > Thanks to Chris and Ben. Your suggestions were slightly > different but both worked equally well, although I don't > understand how that can be so. > >> struct.pack('256s', ifname[:15].encode('ascii')) >>

Re: Python 2 to 3 Conversion

2018-02-18 Thread Wildman via Python-list
Thanks to Chris and Ben. Your suggestions were slightly different but both worked equally well, although I don't understand how that can be so. > struct.pack('256s', ifname[:15].encode('ascii')) > struct.pack('256s', ifname.encode('ascii')) I was looking for a reliable way to determine the IP

Re: Python 2 to 3 Conversion

2018-02-16 Thread Ben Finney
Wildman via Python-list writes: > def get_ip_address(ifname): > s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) > return socket.inet_ntoa(fcntl.ioctl( > s.fileno(), > 0x8915, # SIOCGIFADDR > struct.pack('256s', ifname[:15]) >

Re: Python 2 to 3 Conversion

2018-02-16 Thread Chris Angelico
On Sat, Feb 17, 2018 at 4:15 PM, Wildman via Python-list wrote: > I have a bit of code I found on the web that will return > the ip address of the named network interface. The code > is for Python 2 and it runs fine. But, I want to use the > code with Python 3. Below is

Python 2 to 3 Conversion

2018-02-16 Thread Wildman via Python-list
I have a bit of code I found on the web that will return the ip address of the named network interface. The code is for Python 2 and it runs fine. But, I want to use the code with Python 3. Below is the code followed by the error message. Suggestions appreciated. #!/usr/bin/env python3

Re: Key differences between Python 2 and 3 with examples

2017-05-08 Thread Ben Finney
Chris Angelico writes: > On Mon, May 8, 2017 at 5:57 PM, Steven D'Aprano wrote: > > http://sebastianraschka.com/Articles/2014_python_2_3_key_diff.html > > Error in page: Good catch. But the author likely won't read this message. You can contact them via

Re: Key differences between Python 2 and 3 with examples

2017-05-08 Thread Chris Angelico
On Mon, May 8, 2017 at 5:57 PM, Steven D'Aprano wrote: > And no, it's not just that Python 3 is The Future[1] and Python 2 is The > Past. > > > http://sebastianraschka.com/Articles/2014_python_2_3_key_diff.html > Error in page: print('Python', python_version())

Key differences between Python 2 and 3 with examples

2017-05-08 Thread Steven D'Aprano
And no, it's not just that Python 3 is The Future[1] and Python 2 is The Past. http://sebastianraschka.com/Articles/2014_python_2_3_key_diff.html [1] https://circleci.com/blog/its-the-future/ -- Steve Emoji: a small, fuzzy, indistinct picture used to replace a clear and perfectly

Re: Windows switch between python 2 and 3

2016-10-27 Thread eryk sun
On Thu, Oct 27, 2016 at 3:41 PM, Steve D'Aprano wrote: > On Fri, 28 Oct 2016 02:11 am, Daiyue Weng wrote: > >> Hi, I installed Python 2.7 and Python 3.5 64 bit versions on Win 10. Under >> >> C:\Python35 >> >> C:\Python27 >> >> Both have been set in environment

Re: Windows switch between python 2 and 3

2016-10-27 Thread Daiyue Weng
and 3 in command prompt. > > Along with Python 3.5, the Python Launcher for Windows (py.exe) was > installed in C:\Windows, unless you unchecked it. You can choose > which interpreter you want to run by an argument to py.exe; for Python > 2.7, use `py -2.7`; for Python 3.5, use

Re: Windows switch between python 2 and 3

2016-10-27 Thread Zachary Ware
py.exe; for Python 2.7, use `py -2.7`; for Python 3.5, use `py -3.5`. There are also shortcuts for "latest Python 2" and "latest Python 3", `py -2` and `py -3` respectively. Calling `py` on its own will default to matching `py -2`, but settings can be changed in C:\Windows\py.ini.

Re: Windows switch between python 2 and 3

2016-10-27 Thread Steve D'Aprano
On Fri, 28 Oct 2016 02:11 am, Daiyue Weng wrote: > Hi, I installed Python 2.7 and Python 3.5 64 bit versions on Win 10. Under > > C:\Python35 > > C:\Python27 > > Both have been set in environment variable Path. > > When I type python in cmd, it only gives me python 2.7, I am wondering how >

Re: Windows switch between python 2 and 3

2016-10-27 Thread Veek M
Daiyue Weng wrote: > Hi, I installed Python 2.7 and Python 3.5 64 bit versions on Win 10. > Under > > C:\Python35 > > C:\Python27 > > Both have been set in environment variable Path. > > When I type python in cmd, it only gives me python 2.7, I am wondering > how to switch between 2 and 3 in

Re: Windows switch between python 2 and 3

2016-10-27 Thread Peter Otten
Daiyue Weng wrote: > Hi, I installed Python 2.7 and Python 3.5 64 bit versions on Win 10. Under > > C:\Python35 > > C:\Python27 > > Both have been set in environment variable Path. > > When I type python in cmd, it only gives me python 2.7, I am wondering how > to switch between 2 and 3 in

Windows switch between python 2 and 3

2016-10-27 Thread Daiyue Weng
Hi, I installed Python 2.7 and Python 3.5 64 bit versions on Win 10. Under C:\Python35 C:\Python27 Both have been set in environment variable Path. When I type python in cmd, it only gives me python 2.7, I am wondering how to switch between 2 and 3 in command prompt. cheers --

Re: repr/str diff between Python 2 and 3

2016-10-12 Thread Skip Montanaro
Thanks everyone. I'm not going to try to be too cute, and will just change my test case. I'm leaving Python 2 behind in this particular case for now anyway. I can always return to the issue if I decide I need Python 2.7 support at some point in the future. Skip --

Re: repr/str diff between Python 2 and 3

2016-10-12 Thread Serhiy Storchaka
On 12.10.16 04:30, Skip Montanaro wrote: https://docs.python.org/3/whatsnew/3.1.html It's the third hit when searching for 'float'. Assuming I understand what it's saying. ;) Thanks. Is that the "David Gay's algorithm"? That seems to apply only to repr(), while the change I observed was in

Re: repr/str diff between Python 2 and 3

2016-10-11 Thread Terry Reedy
On 10/11/2016 9:30 PM, Skip Montanaro wrote: https://docs.python.org/3/whatsnew/3.1.html It's the third hit when searching for 'float'. Assuming I understand what it's saying. ;) Thanks. Is that the "David Gay's algorithm"? That seems to apply only to repr(), while the change I observed

Re: repr/str diff between Python 2 and 3

2016-10-11 Thread Ethan Furman
On 10/11/2016 06:30 PM, Skip Montanaro wrote: https://docs.python.org/3/whatsnew/3.1.html It's the third hit when searching for 'float'. Assuming I understand what it's saying. ;) Thanks. Is that the "David Gay's algorithm"? That seems to apply only to repr(), while the change I observed

Re: repr/str diff between Python 2 and 3

2016-10-11 Thread Ben Finney
Skip Montanaro writes: > > Only that one should not rely on ‘str’ preserving the value accurately, > > as documented in Python 2. > > Sure, but this choice is out of my hands. It's csv.writerow that calls > str(), not me. Ah, good old ‘csv’. If the implementation is

Re: repr/str diff between Python 2 and 3

2016-10-11 Thread Terry Reedy
On 10/11/2016 8:59 PM, Skip Montanaro wrote: I'm trying to port some code from Python 2 to 3, and beyond the usual mechanical stuff, I've encountered a difference between the str() of floats. Here's an example. In Python 3 I get: print(repr(27.04 - 0.01)) 27.028 print(str(27.04

Re: repr/str diff between Python 2 and 3

2016-10-11 Thread Skip Montanaro
> Only that one should not rely on ‘str’ preserving the value accurately, > as documented in Python 2. Sure, but this choice is out of my hands. It's csv.writerow that calls str(), not me. I could probably subclass csv.writer and csv.DictWriter, and override the writerow method, but I would

Re: repr/str diff between Python 2 and 3

2016-10-11 Thread Skip Montanaro
> https://docs.python.org/3/whatsnew/3.1.html > > It's the third hit when searching for 'float'. Assuming I understand what it's saying. ;) Thanks. Is that the "David Gay's algorithm"? That seems to apply only to repr(), while the change I observed was in str(). Skip --

Re: repr/str diff between Python 2 and 3

2016-10-11 Thread Ben Finney
Skip Montanaro writes: > >>> print repr(27.04 - 0.01) > 27.028 > >>> print str(27.04 - 0.01) > 27.03 > > My test case writes through a csv writer, which writes the str() of each > element to the output. For Python 2, that's a mistake: str(object='')

Re: repr/str diff between Python 2 and 3

2016-10-11 Thread Ethan Furman
On 10/11/2016 05:59 PM, Skip Montanaro wrote: Is there documentation of this particular change? My searching turned up documentation of plenty of other changes, but not this particular one. 3.1 What's new: https://docs.python.org/3/whatsnew/3.1.html It's the third hit when searching for

repr/str diff between Python 2 and 3

2016-10-11 Thread Skip Montanaro
I'm trying to port some code from Python 2 to 3, and beyond the usual mechanical stuff, I've encountered a difference between the str() of floats. Here's an example. In Python 3 I get: >>> print(repr(27.04 - 0.01)) 27.028 >>> print(str(27.04 - 0.01)) 27.0299

[issue27251] TypeError in logging.HTTPHandler.emit; possible python 2 to 3 conversion issue

2016-06-07 Thread Berker Peksag
Changes by Berker Peksag : -- stage: test needed -> resolved ___ Python tracker ___

  1   2   3   4   5   >