Re: Python 2 @file/@clean Trees in Python 3 Leo?

2021-03-06 Thread Edward K. Ream
On Sat, Mar 6, 2021 at 8:45 AM tbp1...@gmail.com 
wrote:

Thanks, Edward.
>

You're welcome.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAMF8tS3YxGC5mH3Nhkyc7OtMtDDQEPvGCmkZHYNX2N51iM2k%2BA%40mail.gmail.com.


Re: Python 2 @file/@clean Trees in Python 3 Leo?

2021-03-06 Thread tbp1...@gmail.com
Thanks, Edward.

On Saturday, March 6, 2021 at 6:54:44 AM UTC-5 Edward K. Ream wrote:

> On Fri, Mar 5, 2021 at 10:27 PM tbp1...@gmail.com  
> wrote:
>
> Is there a way to have an @clean or @file tree that is valid Python 2, and 
>> save it despite Python 3 errors?
>>
>
> @bool check-python-code-on-write = False
>
> But the premise of your question is faulty. With both @clean and @file Leo 
> *will* save Python 2 files even if  Leo reports python errors, as I have 
> just verified.
>
> Edward
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/14c2c576-7682-4836-8a83-cd7a20c2e0fbn%40googlegroups.com.


Re: Python 2 @file/@clean Trees in Python 3 Leo?

2021-03-06 Thread Edward K. Ream
On Fri, Mar 5, 2021 at 10:27 PM tbp1...@gmail.com 
wrote:

Is there a way to have an @clean or @file tree that is valid Python 2, and
> save it despite Python 3 errors?
>

@bool check-python-code-on-write = False

But the premise of your question is faulty. With both @clean and @file Leo
*will* save Python 2 files even if  Leo reports python errors, as I have
just verified.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAMF8tS3qAY3VJwicR7fy7%2B3iZvhW4oFLkn2qiURG%2Bg%3DVUMF5BQ%40mail.gmail.com.


Python 2 @file/@clean Trees in Python 3 Leo?

2021-03-05 Thread tbp1...@gmail.com
I have some @clean trees in one or another Leo outline (and probably some 
@file ones also), ones that I haven't happened to open for several years.  
Of course, Leo now runs under Python 3.  So when I go to save these files, 
Leo thinks there is a syntax error and won't save them.

I don't know for sure, but the two I wanted to work with today had 
zero-length @clean files.  Fortunately I had copies of the code somewhere 
else.

Is there a way to have an @clean or @file tree that is valid Python 2, and 
save it despite Python 3 errors?  I can't update some of these files to 
Python 3 because they must run in a Python 2 environment (they are actually 
Jython files that run in a servlet under Tomcat, and Jython is only up to 
Python 2.7).

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/bf668c0f-fed6-43a5-adbc-5d5b1e0dd8a5n%40googlegroups.com.


Re: python 2 remnants: create an issue for each or...?

2019-11-21 Thread Matt Wilkie
started: https://github.com/leo-editor/leo-editor/issues/1446

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/ce8adf0b-3957-4e7f-9351-7c10482601f9%40googlegroups.com.


Re: python 2 remnants: create an issue for each or...?

2019-11-19 Thread Edward K. Ream
On Tue, Nov 19, 2019 at 12:34 PM Matt Wilkie  wrote:

> I noticed a function[0] today that was created to simulate python 3, which
> is no longer necessary now that py2 support has been dropped. There's
> probably dozens of these scattered throughout. How should they be flagged
> for refactoring and/or removal? Create an issue for each one or collect
> them into one, or something else?
>

Please collect them in a single issue.  Not all can be fixed, because the
wrapper function doesn't do exactly the same thing as the actual python
function.

Having said that, I definitely do want to clean what can be cleaned.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAMF8tS1F1%2BvNhYkYoQtMc71duEwPSFz4NKwV2%3DTQnA90HK4WkA%40mail.gmail.com.


python 2 remnants: create an issue for each or...?

2019-11-19 Thread Matt Wilkie
I noticed a function[0] today that was created to simulate python 3, which 
is no longer necessary now that py2 support has been dropped. There's 
probably dozens of these scattered throughout. How should they be flagged 
for refactoring and/or removal? Create an issue for each one or collect 
them into one, or something else?

[0] LeoPyRef.leo#Code-->Core classes-->@file 
leoGlobals.py-->g.Scripting-->g.exec_file

-matt

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/ede23912-621e-442a-b504-9b939a0847ff%40googlegroups.com.


Re: No python 2 work after December 1, 2019

2019-06-07 Thread Edward K. Ream
On Wednesday, June 5, 2019 at 1:49:26 PM UTC-5, Terry Brown wrote:
>
>
> But I do think Python 3 is *installed* by default on 18.04.  3.6.7 
> currently.
>

Python 3 does not seem to be installed by default on MacOS, but yesterday I 
had no trouble installing Annaconda3 and running Leo.

Btw, Qt on MacOS does support --gui=qttabs, so there seems to be no reason 
not to have --gui=qt be a synonym for --gui=qttabs.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/e8600024-22de-49b9-bb65-a8ae4a9bebc9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: No python 2 work after December 1, 2019

2019-06-06 Thread Josef
You are probably right.  I was not successful in running Leo with the 
python3 which came with Ubuntu, but that was because there was no matching 
pyQt5 package available at the time when I tried.
I installed python3 and pyQt5 with conda, and that worked for me. This may 
no longer be an issue, depending on the library versions available now. 
I'll find out soon when I try a clean install in the next two weeks.

In my original post I was just thinking about some people, who may not even 
try Leo, because they fail to be able to install it on the first try, but 
most potential Leo users have probably enough computer skills to cope.

On Wednesday, June 5, 2019 at 8:49:26 PM UTC+2, Terry Brown wrote:
>
> Not sure about that, my
> DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"   
> is running 2.7 by default, and I'm sure I did a fresh install, not an 
> upgrade.  99.5% sure anyway ;-)
>
> But I do think Python 3 is *installed* by default on 18.04.  3.6.7 
> currently.
>
> Cheers -Terry
>
> On Wed, Jun 5, 2019 at 9:36 AM Josef > wrote:
>
>> Correction:
>>
>> as far as I heard, Python 3 is already the default on the currrent Ubuntu 
>> 18.04 LTS. I was under the wrong assumption that Python 2 is the default, 
>> because when I upgraded from 16.04 LTS to 18.04 LTS the default Python 
>> installation did not change from 2 to 3.
>>
>> Sorry, if I caused any confusion.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "leo-editor" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to leo-e...@googlegroups.com .
>> To post to this group, send email to leo-e...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/leo-editor.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/leo-editor/b2f938c9-6d81-4674-aae6-71c1a7182dc8%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/leo-editor/b2f938c9-6d81-4674-aae6-71c1a7182dc8%40googlegroups.com?utm_medium=email_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/7c962165-42ac-4f8f-83ef-d8473125f6cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: No python 2 work after December 1, 2019

2019-06-05 Thread Terry Brown
Not sure about that, my
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"
is running 2.7 by default, and I'm sure I did a fresh install, not an
upgrade.  99.5% sure anyway ;-)

But I do think Python 3 is *installed* by default on 18.04.  3.6.7
currently.

Cheers -Terry

On Wed, Jun 5, 2019 at 9:36 AM Josef  wrote:

> Correction:
>
> as far as I heard, Python 3 is already the default on the currrent Ubuntu
> 18.04 LTS. I was under the wrong assumption that Python 2 is the default,
> because when I upgraded from 16.04 LTS to 18.04 LTS the default Python
> installation did not change from 2 to 3.
>
> Sorry, if I caused any confusion.
>
> --
> You received this message because you are subscribed to the Google Groups
> "leo-editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to leo-editor+unsubscr...@googlegroups.com.
> To post to this group, send email to leo-editor@googlegroups.com.
> Visit this group at https://groups.google.com/group/leo-editor.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/leo-editor/b2f938c9-6d81-4674-aae6-71c1a7182dc8%40googlegroups.com
> <https://groups.google.com/d/msgid/leo-editor/b2f938c9-6d81-4674-aae6-71c1a7182dc8%40googlegroups.com?utm_medium=email_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAFPg46Q_oWJCqx3N7qxtN88-Jsg5SYkK8EJscDFMU2%2Bv-p%2BVTw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: No python 2 work after December 1, 2019

2019-06-05 Thread Josef
Correction:

as far as I heard, Python 3 is already the default on the currrent Ubuntu 
18.04 LTS. I was under the wrong assumption that Python 2 is the default, 
because when I upgraded from 16.04 LTS to 18.04 LTS the default Python 
installation did not change from 2 to 3.

Sorry, if I caused any confusion.

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/b2f938c9-6d81-4674-aae6-71c1a7182dc8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: No python 2 work after December 1, 2019

2019-06-05 Thread Josef


On Thursday, May 2, 2019 at 1:00:23 PM UTC+2, Edward K. Ream wrote:
>
> December 1 of this year is a firm cutoff date for further work in the 
> unified python 2/3 code base that is the basis for Leo 5.9.  After that, 
> further work would be pointless, because official support for Python 2 will 
> end on December 31.
>
> I suspect there will be a 5.9.1 release of Leo that will fix difficulties 
> with LeoWapp.
>
> Edward
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/d58d5a5c-d414-46d5-9898-b6fbdf8e4fb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: No python 2 work after December 1, 2019

2019-05-06 Thread Rob
That makes me wonder what Apple is doing. Does anyone know what the default 
Python version is for new MacOS installations? Mine is several years old 
and Python 2.x. I keep the OS updated, but don't think that includes Python 
updates by default (at least I don't think so).

Most of my work is on Windows and I can update Python easily enough myself. 
Not so much with my MacBook Pro for traveling.

Rob...

On Monday, May 6, 2019 at 11:11:09 AM UTC-4, Edward K. Ream wrote:
>
> On Monday, May 6, 2019 at 8:59:01 AM UTC-5, Josef wrote:
>>
>>
>> I think the default installation of Leo should always run on Ubuntu LTS.
>>
>
> Leo 5.9 will run on Python 2.
>
> I'll let the Ubuntu folks figure out how to transition to Python 3.
>
> Edward
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: No python 2 work after December 1, 2019

2019-05-06 Thread Edward K. Ream
On Monday, May 6, 2019 at 8:59:01 AM UTC-5, Josef wrote:
>
>
> I think the default installation of Leo should always run on Ubuntu LTS.
>

Leo 5.9 will run on Python 2.

I'll let the Ubuntu folks figure out how to transition to Python 3.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: No python 2 work after December 1, 2019

2019-05-06 Thread Josef
Hmm,

I think the default installation of Leo should always run on Ubuntu LTS.

Ubuntu LTS and derivatives still have by default Python 2 installed. The 
next Ubuntu LTS won't be out until April 2020 (and the automatic upgrade 
from an earlier LTS won't happen until Ubuntu 20.4.1, probably around June 
2020). 

- Josef

On Thursday, May 2, 2019 at 1:00:23 PM UTC+2, Edward K. Ream wrote:
>
> December 1 of this year is a firm cutoff date for further work in the 
> unified python 2/3 code base that is the basis for Leo 5.9.  After that, 
> further work would be pointless, because official support for Python 2 will 
> end on December 31.
>
> I suspect there will be a 5.9.1 release of Leo that will fix difficulties 
> with LeoWapp.
>
> Edward
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


No python 2 work after December 1, 2019

2019-05-02 Thread Edward K. Ream
December 1 of this year is a firm cutoff date for further work in the 
unified python 2/3 code base that is the basis for Leo 5.9.  After that, 
further work would be pointless, because official support for Python 2 will 
end on December 31.

I suspect there will be a 5.9.1 release of Leo that will fix difficulties 
with LeoWapp.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Python 2?

2018-03-13 Thread Edward K. Ream
On Mon, Mar 12, 2018 at 3:50 PM, David Szent-Györgyi 
wrote:

>
> There may be a better option than JSON. I recall a blog posting about the
> limitations of JSON that are overcome by AXON
> .
> The posting states that unlike JSON, AXON supports comments, provides
> syntax for decimal and date/time values, and supports streams of values.
>
> The Pypi package pyaxon  runs on
> Python 2.7, 3.3, 3.4, 3.5. Source code is available on GitHub
> .
>
> In case the original blog posting is not available, it is quoted
> extensively in a tuicool posting 
> .
>

​Thanks, David, for these links.  I'll keep these in mind in case the
pickle-based code can't be improved.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Python 2?

2018-03-12 Thread David Szent-Györgyi


On Sunday, March 11, 2018 at 7:19:24 PM UTC-4, Edward K. Ream wrote:
>
> I have just created #800: Replace pickle with json everywhere in Leo 
> . 
>
> Imo, this is a high priority item.  It should have been done long ago.  
> Terry, do you agree?
>
> I switch frequently, and see this a lot.
>
>
> ​Interesting.  I never see this.  It's fallen off my radar.
>

There may be a better option than JSON. I recall a blog posting about the 
limitations of JSON that are overcome by AXON 
. The 
posting states that unlike JSON, AXON supports comments, provides syntax 
for decimal and date/time values, and supports streams of values. 

The Pypi package pyaxon  runs on 
Python 2.7, 3.3, 3.4, 3.5. Source code is available on GitHub 
. 

In case the original blog posting is not available, it is quoted 
extensively in a tuicool posting . 

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Python 2?

2018-03-11 Thread Edward K. Ream
On Sat, Mar 10, 2018 at 6:52 PM, Terry Brown  wrote:

Bottom line I think pickle's a bad format for anything except transient
> serialization
>

​Let's google "python alternative to pickle":

First hit: Don't Pickle Your Data
. The
recommendation: just use json. Pickle is slow, python-centric and is a
security risk. I googled "python to json" which yields python's json module
.

I have just created #800: Replace pickle with json everywhere in Leo
.

Imo, this is a high priority item.  It should have been done long ago.
Terry, do you agree?

I switch frequently, and see this a lot.


​Interesting.  I never see this.  It's fallen off my radar.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: Python 2?

2018-03-10 Thread Terry Brown
Yes, although it seems to have been worse since Vitalige's cache
related work.  Python 2/3 pickle protocols aren't compatible by
default.  It's possible that there's some relatively new code that
should be changed to use an older protocol, not sure about that.

Bottom line I think pickle's a bad format for anything except transient
serialization, like between processes in a distributed computation.
JSON's definitely worth the extra work to serialize dates, sets, etc.
in terms of durability and compatibility.

I switch frequently, and see this a lot.  I'm not saying that
eliminating use of pickle should be a high priority, just worth
checking if there's anything that could cut down on these issues easily.

Cheers -Terry

On Sat, 10 Mar 2018 13:07:39 -0800 (PST)
Chris George <technat...@gmail.com> wrote:

> This is the first time in years I have loaded python2 and tried to
> run Leo. Is this normal?
> 
> Chris
> 
> Leo Log Window
> Leo 5.8 devel, build 20180307231313, Wed Mar 7 23:13:13 PST 2018
> Git repo info: branch = devel, commit = a31ff9cc5543
> Python 2.7.14, PyQt version 5.10.0
> linux2
> isPython3: False
> caching enabled
> reading: /home/chris/Working/BreezeStyleSheets/Breeze Dark Theme -
> KDE Plasma.leo
> read outline in 0.19 seconds
> auto save 300 sec. after changes
> Unpickling error - Python 3 data accessed from Python 2?
> Unpickling error - Python 3 data accessed from Python 2?
> Unpickling error - Python 3 data accessed from Python 2?
> Unpickling error - Python 3 data accessed from Python 2?
> Unpickling error - Python 3 data accessed from Python 2?
> Unpickling error - Python 3 data accessed from Python 2?
> hook failed: after-create-leo-frame2,  FreeLayoutController.loadLayouts of 
>  0x7fdec815e890>>, 
> Traceback (most recent call last):
> 
> File "/home/chris/leo-editor/leo/core/leoPlugins.py", line 342, in 
> callTagHandler
> result = handler(tag, keywords)
> 
> File "/home/chris/leo-editor/leo/plugins/free_layout.py", line 241,
> in loadLayouts
> layout = d.get(name)
> 
> AttributeError: 'NoneType' object has no attribute 'get'
> 
> 

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Python 2?

2018-03-10 Thread Chris George
This is the first time in years I have loaded python2 and tried to run Leo. 
Is this normal?

Chris

Leo Log Window
Leo 5.8 devel, build 20180307231313, Wed Mar 7 23:13:13 PST 2018
Git repo info: branch = devel, commit = a31ff9cc5543
Python 2.7.14, PyQt version 5.10.0
linux2
isPython3: False
caching enabled
reading: /home/chris/Working/BreezeStyleSheets/Breeze Dark Theme - KDE 
Plasma.leo
read outline in 0.19 seconds
auto save 300 sec. after changes
Unpickling error - Python 3 data accessed from Python 2?
Unpickling error - Python 3 data accessed from Python 2?
Unpickling error - Python 3 data accessed from Python 2?
Unpickling error - Python 3 data accessed from Python 2?
Unpickling error - Python 3 data accessed from Python 2?
Unpickling error - Python 3 data accessed from Python 2?
hook failed: after-create-leo-frame2, >, 

Traceback (most recent call last):

File "/home/chris/leo-editor/leo/core/leoPlugins.py", line 342, in 
callTagHandler
result = handler(tag, keywords)

File "/home/chris/leo-editor/leo/plugins/free_layout.py", line 241, in 
loadLayouts
layout = d.get(name)

AttributeError: 'NoneType' object has no attribute 'get'


-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: 63d3229: VR renders LaTex (python 2 only)

2017-03-24 Thread Edward K. Ream
On Friday, March 24, 2017 at 9:37:15 AM UTC-5, Edward K. Ream wrote:
>
> It renders LaTeX <https://www.latex-project.org/>using mathjax 
> <https://www.mathjax.org/>in a QtWebKitWidgets.QWebView. 
>
> This is *experimental code*, and *only works with Python 2*. On my 
> Windows 10 machine, it hangs when using Python 3. I have no idea why.
>
> Even on a fast machine, it takes several seconds to render Maxwell's 
> equations:
>

On Linux, rendering is *much *faster than on Windows and works for both 
Python 2 and 3.

Rev 20601c disables rendering only on Windows and only when using Python 3.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: 63d3229: VR renders LaTex (python 2 only)

2017-03-24 Thread Edward K. Ream
On Friday, March 24, 2017 at 9:37:15 AM UTC-5, Edward K. Ream wrote:
>
> It renders LaTeX <https://www.latex-project.org/>using mathjax 
> <https://www.mathjax.org/>in a QtWebKitWidgets.QWebView. 
>
> This is *experimental code*, and *only works with Python 2*. On my 
> Windows 10 machine, it hangs when using Python 3. I have no idea why.
>

I should have added that VR plugin avoids the hang by not rendering when 
g.isPython3 is True. Not great, but better than hanging ;-)

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


63d3229: VR renders LaTex (python 2 only)

2017-03-24 Thread Edward K. Ream
It renders LaTeX <https://www.latex-project.org/>using mathjax 
<https://www.mathjax.org/>in a QtWebKitWidgets.QWebView. 

This is *experimental code*, and *only works with Python 2*. On my Windows 
10 machine, it hangs when using Python 3. I have no idea why.

Even on a fast machine, it takes several seconds to render Maxwell's 
equations:

\begin{align}
  \nabla \times \vec{\mathbf{B}} -\, \frac1c\, 
\frac{\partial\vec{\mathbf{E}}}{\partial t} & = 
\frac{4\pi}{c}\vec{\mathbf{j}} \\
  \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \\
  \nabla \times \vec{\mathbf{E}}\, +\, \frac1c\, 
\frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \\
  \nabla \cdot \vec{\mathbf{B}} & = 0
\end{align}
yielding the attached image. I'll be testing on Ubuntu next.
Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: How many of you must still use Python 2?

2016-09-21 Thread Edward K. Ream

On Wednesday, September 21, 2016 at 9:24:41 AM UTC-5, Terry Brown wrote:

But I'm not arguing for 2.6, the above doesn't affect my use of Leo ;-) and 
> not being able to use 2.7 features in Python code is very annoying.
>

I agree.  Leo should officially state that it requires Python 2.7.  This 
should not be a big problem for anyone.

EKR

>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: How many of you must still use Python 2?

2016-09-21 Thread 'Terry Brown' via leo-editor
Red Hat Enterprise Linux (RHEL) 6 uses 2.6 as its system python. RHEL 6 is 
superseded by RHEL 7, but RHEL 6 is still a long way from its end of life, 
people are still using it.
But I'm not arguing for 2.6, the above doesn't affect my use of Leo ;-) and not 
being able to use 2.7 features in Python code is very annoying.
Cheers -Terry
 
  From: Propadovic Nenad <npropado...@gmail.com>
 To: leo-editor@googlegroups.com 
 Sent: Wednesday, September 21, 2016 1:17 AM
 Subject: Re: How many of you must still use Python 2?
   
"Is there any need for Python 2 support earlier than 2.7?"
That's a completely different kind of question.
If I remember well, last time I used Python 2.6 was in 2012.

2016-09-21 7:42 GMT+02:00 Viktor Ransmayr <viktor.ransm...@gmail.com>:

Am Montag, 19. September 2016 13:43:34 UTC+2 schrieb Edward K. Ream:
I do most of my testing these days using Python 3.  I am wondering how many Leo 
users still must use Python 2.

Don't panic.  I have no plans to remove support for Python 2 in the near future.


I think in order to reduce the test & support effort for Leo a refinement of 
this question would be:

Is there any need for Python 2 support earlier than 2.7?

With kind regards,

Viktor 
-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscribe@ googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/ group/leo-editor.
For more options, visit https://groups.google.com/d/ optout.


-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


   
 

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: How many of you must still use Python 2?

2016-09-21 Thread Edward K. Ream
On Wed, Sep 21, 2016 at 12:42 AM, Viktor Ransmayr <viktor.ransm...@gmail.com
> wrote:

>
> Is there any need for Python 2 support earlier than 2.7?
>

​No, imo.  I use 2.7 for all Python 2 testing.  Leo's docs mention that it
will work with Python 2.6, but I see no reason not to require 2.7.

I'll change the docs (and Leo's web site) unless I hear from somebody who
must use Python 2.6.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: How many of you must still use Python 2?

2016-09-21 Thread Propadovic Nenad
"Is there any need for Python 2 support earlier than 2.7?"
That's a completely different kind of question.
If I remember well, last time I used Python 2.6 was in 2012.

2016-09-21 7:42 GMT+02:00 Viktor Ransmayr <viktor.ransm...@gmail.com>:

> Am Montag, 19. September 2016 13:43:34 UTC+2 schrieb Edward K. Ream:
>>
>> I do most of my testing these days using Python 3.  I am wondering how
>> many Leo users still must use Python 2.
>>
>> Don't panic.  I have no plans to remove support for Python 2 in the near
>> future.
>>
>
> I think in order to reduce the test & support effort for Leo a refinement
> of this question would be:
>
> Is there any need for Python 2 support earlier than 2.7?
>
> With kind regards,
>
> Viktor
>
> --
> You received this message because you are subscribed to the Google Groups
> "leo-editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to leo-editor+unsubscr...@googlegroups.com.
> To post to this group, send email to leo-editor@googlegroups.com.
> Visit this group at https://groups.google.com/group/leo-editor.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: How many of you must still use Python 2?

2016-09-20 Thread Viktor Ransmayr
Am Montag, 19. September 2016 13:43:34 UTC+2 schrieb Edward K. Ream:
>
> I do most of my testing these days using Python 3.  I am wondering how 
> many Leo users still must use Python 2.
>
> Don't panic.  I have no plans to remove support for Python 2 in the near 
> future.
>

I think in order to reduce the test & support effort for Leo a refinement 
of this question would be:

Is there any need for Python 2 support earlier than 2.7?

With kind regards,

Viktor 

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: How many of you must still use Python 2?

2016-09-19 Thread 'Terry Brown' via leo-editor
My use of Leo at work, which is very important to me ;-) really depends on it 
being Python 2.7.
Note to self: At home, I should switch to 3 for Leo, just to make sure my 
chosen plugins work.
Cheers -Terry
 
  From: Edward K. Ream <edream...@gmail.com>
 To: leo-editor <leo-editor@googlegroups.com> 
 Sent: Monday, September 19, 2016 6:43 AM
 Subject: How many of you must still use Python 2?
   
I do most of my testing these days using Python 3.  I am wondering how many Leo 
users still must use Python 2.

Don't panic.  I have no plans to remove support for Python 2 in the near future.

Edward
-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


   
 

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: How many of you must still use Python 2?

2016-09-19 Thread Zoom.Quiet
i always base py 2, because all project is in py 2 ...
and also all linux default installed is py 2.

On Mon, Sep 19, 2016 at 6:43 AM, Edward K. Ream <edream...@gmail.com> wrote:
> I do most of my testing these days using Python 3.  I am wondering how many
> Leo users still must use Python 2.
>
> Don't panic.  I have no plans to remove support for Python 2 in the near
> future.
>
> Edward
>
> --
> You received this message because you are subscribed to the Google Groups
> "leo-editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to leo-editor+unsubscr...@googlegroups.com.
> To post to this group, send email to leo-editor@googlegroups.com.
> Visit this group at https://groups.google.com/group/leo-editor.
> For more options, visit https://groups.google.com/d/optout.



-- 
life is pathetic, go Pythonic! 人生苦短, Python当歌!
俺: http://zoomquiet.io
授: http://creativecommons.org/licenses/by-sa/2.5/cn/
怒: 冗余不做,日子甭过!备份不做,十恶不赦!
KM keep growing environment culture which promoting organization be learnning!

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: How many of you must still use Python 2?

2016-09-19 Thread Chris George
I find myself learning python, so chose to stick with python3. I have 
always used Leo for prose and poetry,; this is the first crack at learning 
to code for me.

On Monday, September 19, 2016 at 5:28:51 AM UTC-7, Propadovic Nenad wrote:
>
> * I'm sorry not to be able to say for the current project, as the decision 
> to move back to Python 2 was made before I joined the project some 4 months 
> ago. (I'm a contractor, historically switching 
> projects/departments/projects at least once a year).
> * For the previous project, it was not a library, but a whole environment 
> built within BMW where the team who built it was released after they 
> finished their job. Nobody of the people currently in charge would even 
> dare to touch anything, least starting to move to Python 3.
> * Previous to that, it was a Test Automation tool, built upon Python 2, 
> and sold for some 10K € for a workplace. Maybe the company who sells it 
> will care to move to Python 3 some time, but they're probably in no hurry. 
> In the german automotive industry the time stands still.
> * Before that, it was some Websocket library not available in Python 3. In 
> a startup, a quite up-beat one, doing a very nice web application.
> The last project I mentioned ended in January 2015. The other three came 
> later.
>
> 2016-09-19 13:56 GMT+02:00 Edward K. Ream <edre...@gmail.com 
> >:
>
>> On Monday, September 19, 2016 at 6:52:41 AM UTC-5, Propadovic Nenad wrote:
>>
>> I use Python 2 daily, not by choice, neither mine nor by the companie(s) 
>>> I work for. It just happens so that here and there some library we need is 
>>> lacking, so, I must say, I've never done a pure Python 3 project by now.
>>>
>>
>> Which library is that, if you don't mind my asking? 
>>
>> Thanks for the reply.  I'm sure there are others in your situation.  I am 
>> curious to know about how many.  So please let me know if you are someone 
>> else in the same situation.
>>
>> EKR
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "leo-editor" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to leo-editor+...@googlegroups.com .
>> To post to this group, send email to leo-e...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/leo-editor.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: How many of you must still use Python 2?

2016-09-19 Thread Propadovic Nenad
* I'm sorry not to be able to say for the current project, as the decision
to move back to Python 2 was made before I joined the project some 4 months
ago. (I'm a contractor, historically switching
projects/departments/projects at least once a year).
* For the previous project, it was not a library, but a whole environment
built within BMW where the team who built it was released after they
finished their job. Nobody of the people currently in charge would even
dare to touch anything, least starting to move to Python 3.
* Previous to that, it was a Test Automation tool, built upon Python 2, and
sold for some 10K € for a workplace. Maybe the company who sells it will
care to move to Python 3 some time, but they're probably in no hurry. In
the german automotive industry the time stands still.
* Before that, it was some Websocket library not available in Python 3. In
a startup, a quite up-beat one, doing a very nice web application.
The last project I mentioned ended in January 2015. The other three came
later.

2016-09-19 13:56 GMT+02:00 Edward K. Ream <edream...@gmail.com>:

> On Monday, September 19, 2016 at 6:52:41 AM UTC-5, Propadovic Nenad wrote:
>
> I use Python 2 daily, not by choice, neither mine nor by the companie(s) I
>> work for. It just happens so that here and there some library we need is
>> lacking, so, I must say, I've never done a pure Python 3 project by now.
>>
>
> Which library is that, if you don't mind my asking?
>
> Thanks for the reply.  I'm sure there are others in your situation.  I am
> curious to know about how many.  So please let me know if you are someone
> else in the same situation.
>
> EKR
>
> --
> You received this message because you are subscribed to the Google Groups
> "leo-editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to leo-editor+unsubscr...@googlegroups.com.
> To post to this group, send email to leo-editor@googlegroups.com.
> Visit this group at https://groups.google.com/group/leo-editor.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: How many of you must still use Python 2?

2016-09-19 Thread Edward K. Ream
On Monday, September 19, 2016 at 6:52:41 AM UTC-5, Propadovic Nenad wrote:

I use Python 2 daily, not by choice, neither mine nor by the companie(s) I 
> work for. It just happens so that here and there some library we need is 
> lacking, so, I must say, I've never done a pure Python 3 project by now.
>

Which library is that, if you don't mind my asking? 

Thanks for the reply.  I'm sure there are others in your situation.  I am 
curious to know about how many.  So please let me know if you are someone 
else in the same situation.

EKR

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: How many of you must still use Python 2?

2016-09-19 Thread Propadovic Nenad
I use Python 2 daily, not by choice, neither mine nor by the companie(s) I
work for. It just happens so that here and there some library we need is
lacking, so, I must say, I've never done a pure Python 3 project by now.

2016-09-19 13:43 GMT+02:00 Edward K. Ream <edream...@gmail.com>:

> I do most of my testing these days using Python 3.  I am wondering how
> many Leo users still must use Python 2.
>
> Don't panic.  I have no plans to remove support for Python 2 in the near
> future.
>
> Edward
>
> --
> You received this message because you are subscribed to the Google Groups
> "leo-editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to leo-editor+unsubscr...@googlegroups.com.
> To post to this group, send email to leo-editor@googlegroups.com.
> Visit this group at https://groups.google.com/group/leo-editor.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


How many of you must still use Python 2?

2016-09-19 Thread Edward K. Ream
I do most of my testing these days using Python 3.  I am wondering how many 
Leo users still must use Python 2.

Don't panic.  I have no plans to remove support for Python 2 in the near 
future.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Automatic creation of a code base that will run on both Python 2.x and 3.x

2013-04-16 Thread Edward K. Ream
leo\extensions\docutils is intended to work (eventually) on either Python 
2.x or 3.x.  I spent much of yesterday investigating what is required.

The 2to3 tool might be used to create such a common code base 
automatically, or semi-automatically.  I wrote Guido and David Goodger 
about this idea, but they are busy with other projects. The following is my 
letter to them.  I'd like your comments.

Q
**Executive summary**: 2to3 isn't so useful for creating a common code base 
that will run unchanged on both Python 2 and 3.  Relatively minor changes 
to 2to3 would make that task much easier, thereby speeding the adoption of 
Python 3.

docutils illustrates how a more capable 2to3 would be useful.  It's just 
one example of many.

Yesterday I spent some time converting docutils to a common code base, so 
that it could be included without fuss in Leo's distro.  I did this using 
the same technique that I initially used for Leo.  I ran the *original* 
(Python 2.x) source on Python 3, and fixed the crashes as they arose :-)  

It only took a few hours to get docutils working, but there are obvious 
problems with this ad-hoc approach. Indeed, I could contemplate an ad-hock 
conversion strategy because the stakes are relatively small:  if my port 
of docutils fails, a few Leo commands break.  But this strategy is out of 
the question for David; the stakes are much higher for him.  (Leo uses my 
port only as a fallback when Leo can't import an official version of 
docutils. This fallback is important, because docutils formats Leo's help 
commands.)

Putting myself in David's place, I see why he sticks with the Python 2.x 
code base, and why he uses 2to3  to create Python 3.x sources as needed.  
However, this strategy has two drawbacks.  As my experience shows, it 
definitely hinders people from using docutils on Python 3.x on Windows.  
This strategy also prevents distutils from moving to a Python 3 code base 
(or a common code base).

As I thought about what David or I would need to do to do the job properly, 
I had a head-slapping moment.  I haven't used 2to3 to create a common code 
base because 2to3 isn't designed for that.  But it could be, and that would 
make a big difference!

Later, I'll suggest how 2to3 could create a common code base 
automatically.  First, let's see how David or I might *safely* create a 
common code base with the present 2to3.

Step 1.  Devise an *automated* way of using 2to3 to create a common code 
base.  This depends on the distinction between:

A. Code that will run on either 2 or 3 without change.

B. Code that must be different depending on whether 2 or 3 is used.

'print' statements are an example of A (Python 2.6 and above).  Changed 
import statements are an example of B.  The most important instances of B 
are all changes related to unicode.

The six package masks this distinction, which may or may not be an 
advantage, depending on your point of view.

The A/B distinction divides the 2to3 fixers into two categories:  The A 
fixers can be run *safely* to create a common code base.  The B fixers 
cannot!  For B fixers, we must switch code at run time.  Last night I just 
tested sys.version_info  (3,0).  Using six does the same indirectly.

Step 2: Put the plan into motion.

I haven't done this yet, but here is the plan:

- Starting with a Python 2 code base, run *only* the A fixers to create a 
**halfway** code base. 

- Next, run the B fixers on the halfway base, *without* changing the 
halfway base, creating an **all-3** code base.

- Somehow(!) merge the halfway and all-3 bases.  The merge could involve 
adding tests for sys.version_info, or it could replace code with calls to 
six. Given the stakes, the merge must be automatic! I'll want to mark all 
merges with comments in the code itself.

With this (untested) strategy in place, the corresponding changes in 2to3 
become clear:

1. Incorporate the A/B distinction into 2to3.  Give users options to run 
all A fixers, all B fixers or both A and B fixers.

2a. Allow B fixers to generate calls to six, or

2b. Allow B fixers to choose between 2 and 3 code at runtime using 
sys.version_info. The code need not be the cleanest, especially if the code 
is marked with comments.

In short, relatively small changes to 2to3 might make it *much* easier to 
create common code bases.  This might greatly speed the adoption of Python 
3.

Without an enhanced 2to3, I plan to create a script that will merge the 
halfway and all-3 code bases. I'll report my experience with the merge 
script when it materializes :-)  Or maybe I'll hack 2to3...
Q

Edward

-- 
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to leo-editor+unsubscr...@googlegroups.com.
To post to this group, send email to leo-editor@googlegroups.com.
Visit this group at http://groups.google.com/group/leo-editor?hl=en.
For more options, visit https

Re: Automatic creation of a code base that will run on both Python 2.x and 3.x

2013-04-16 Thread Matt Wilkie
tangent to original topic:

 Last night I just tested sys.version_info  (3,0).

I just learned this last night, using `sys.hexversion` is a simpler method
to determining one's place in the python version lineage, albeit with an
extra mental parsing load for the minor version numbers and patch levels.

http://stackoverflow.com/questions/1093322/how-do-i-check-what-version-of-python-is-running-my-script

if sys.hexversion  0x0300:
from urllib2 import urlopen # python 2 or less
else:
from urllib.request import urlopen  # python 3+




On Tue, Apr 16, 2013 at 10:12 AM, Edward K. Ream edream...@gmail.comwrote:

 leo\extensions\docutils is intended to work (eventually) on either Python
 2.x or 3.x.  I spent much of yesterday investigating what is required.

 The 2to3 tool might be used to create such a common code base
 automatically, or semi-automatically.  I wrote Guido and David Goodger
 about this idea, but they are busy with other projects. The following is my
 letter to them.  I'd like your comments.

 Q
 **Executive summary**: 2to3 isn't so useful for creating a common code
 base that will run unchanged on both Python 2 and 3.  Relatively minor
 changes to 2to3 would make that task much easier, thereby speeding the
 adoption of Python 3.

 docutils illustrates how a more capable 2to3 would be useful.  It's just
 one example of many.

 Yesterday I spent some time converting docutils to a common code base, so
 that it could be included without fuss in Leo's distro.  I did this using
 the same technique that I initially used for Leo.  I ran the *original*
 (Python 2.x) source on Python 3, and fixed the crashes as they arose :-)

 It only took a few hours to get docutils working, but there are obvious
 problems with this ad-hoc approach. Indeed, I could contemplate an ad-hock
 conversion strategy because the stakes are relatively small:  if my port
 of docutils fails, a few Leo commands break.  But this strategy is out of
 the question for David; the stakes are much higher for him.  (Leo uses my
 port only as a fallback when Leo can't import an official version of
 docutils. This fallback is important, because docutils formats Leo's help
 commands.)

 Putting myself in David's place, I see why he sticks with the Python 2.x
 code base, and why he uses 2to3  to create Python 3.x sources as needed.
 However, this strategy has two drawbacks.  As my experience shows, it
 definitely hinders people from using docutils on Python 3.x on Windows.
 This strategy also prevents distutils from moving to a Python 3 code base
 (or a common code base).

 As I thought about what David or I would need to do to do the job
 properly, I had a head-slapping moment.  I haven't used 2to3 to create a
 common code base because 2to3 isn't designed for that.  But it could be,
 and that would make a big difference!

 Later, I'll suggest how 2to3 could create a common code base
 automatically.  First, let's see how David or I might *safely* create a
 common code base with the present 2to3.

 Step 1.  Devise an *automated* way of using 2to3 to create a common code
 base.  This depends on the distinction between:

 A. Code that will run on either 2 or 3 without change.

 B. Code that must be different depending on whether 2 or 3 is used.

 'print' statements are an example of A (Python 2.6 and above).  Changed
 import statements are an example of B.  The most important instances of B
 are all changes related to unicode.

 The six package masks this distinction, which may or may not be an
 advantage, depending on your point of view.

 The A/B distinction divides the 2to3 fixers into two categories:  The A
 fixers can be run *safely* to create a common code base.  The B fixers
 cannot!  For B fixers, we must switch code at run time.  Last night I just
 tested sys.version_info  (3,0).  Using six does the same indirectly.

 Step 2: Put the plan into motion.

 I haven't done this yet, but here is the plan:

 - Starting with a Python 2 code base, run *only* the A fixers to create a
 **halfway** code base.

 - Next, run the B fixers on the halfway base, *without* changing the
 halfway base, creating an **all-3** code base.

 - Somehow(!) merge the halfway and all-3 bases.  The merge could involve
 adding tests for sys.version_info, or it could replace code with calls to
 six. Given the stakes, the merge must be automatic! I'll want to mark all
 merges with comments in the code itself.

 With this (untested) strategy in place, the corresponding changes in 2to3
 become clear:

 1. Incorporate the A/B distinction into 2to3.  Give users options to run
 all A fixers, all B fixers or both A and B fixers.

 2a. Allow B fixers to generate calls to six, or

 2b. Allow B fixers to choose between 2 and 3 code at runtime using
 sys.version_info. The code need not be the cleanest, especially if the code
 is marked with comments.

 In short, relatively small changes to 2to3 might make it *much* easier to
 create common code bases

Re: Six: Python 2 and 3 Compatibility Library

2012-08-21 Thread Edward K. Ream
On Sun, Aug 19, 2012 at 1:00 PM, Ville M. Vainio vivai...@gmail.com wrote:
 http://packages.python.org/six/

 Leo does similar abstraction, maybe some homegrown stuff could be replaced 
 with this module?

Thanks for this.  It will be interesting to compare approaches, and
yes, using six might have some benefits.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com.
To unsubscribe from this group, send email to 
leo-editor+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.



Six: Python 2 and 3 Compatibility Library

2012-08-19 Thread Ville M. Vainio
http://packages.python.org/six/

Leo does similar abstraction, maybe some homegrown stuff could be replaced
with this module?

-- 
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com.
To unsubscribe from this group, send email to 
leo-editor+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.



A reminder: developers, pls run unit tests with Python 2 *and* 3

2012-05-18 Thread Edward K. Ream
Rev 5308 fixes a recent problem with urllib.unquote with Python 3k.
It would have shown up had the unit tests been run with Python 3k as
well as Python 2k.

EKR

-- 
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com.
To unsubscribe from this group, send email to 
leo-editor+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.



Re: A reminder: developers, pls run unit tests with Python 2 *and* 3

2012-05-18 Thread Terry Brown
On Fri, 18 May 2012 07:12:19 -0700 (PDT)
Edward K. Ream edream...@gmail.com wrote:

 Rev 5308 fixes a recent problem with urllib.unquote with Python 3k.
 It would have shown up had the unit tests been run with Python 3k as
 well as Python 2k.

My bad - I was going to point out that install qt in python 3 is a
chore, but apparently it's already done on my system - I have qt 4.8
installed for python 2.7, and qt 4.7 installed for python 3.2... not
sure how that happened.

I do invariably forget how to run the unit tests, and it's always
difficult to rediscover that information.  Which outline do you load,
which node do you select, which key do you press, and where is this
documented?  The Docs in unitTest.leo appear to be out of date.

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com.
To unsubscribe from this group, send email to 
leo-editor+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.



Re: A reminder: developers, pls run unit tests with Python 2 *and* 3

2012-05-18 Thread Edward K. Ream
On Fri, May 18, 2012 at 10:00 AM, Terry Brown terry_n_br...@yahoo.com wrote:

 I do invariably forget how to run the unit tests

1. Load unitTest.leo (you will do this for both Python 2k and 3k).
2. Select the node Active Unit Tests
3. Run one or both of the following:

(Fast) run-selected-unit-tests-externally (Alt-5)
(Slow) run-selected-unit-tests-locally (Alt-6)

**Important**: you are really only looking for *new* failures.  So if
you run the unit tests on your copy of the unmodified trunk, and you
see failures A, B  C, you can ignore such failures when testing your
mods.

HTH.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com.
To unsubscribe from this group, send email to 
leo-editor+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.



Re: A reminder: developers, pls run unit tests with Python 2 *and* 3

2012-05-18 Thread Terry Brown
On Fri, 18 May 2012 07:12:19 -0700 (PDT)
Edward K. Ream edream...@gmail.com wrote:

 Rev 5308 fixes a recent problem with urllib.unquote with Python 3k.
 It would have shown up had the unit tests been run with Python 3k as
 well as Python 2k.

Hmm, in 3.2 I get the same two failures for 5302 and 5303, 5303 being
where I inserted the bad imports.

Cheers -Terry

-- 
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com.
To unsubscribe from this group, send email to 
leo-editor+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.



Re: A reminder: developers, pls run unit tests with Python 2 *and* 3

2012-05-18 Thread Edward K. Ream
On Fri, May 18, 2012 at 10:29 AM, Terry Brown terry_n_br...@yahoo.com wrote:

 Hmm, in 3.2 I get the same two failures for 5302 and 5303, 5303 being
 where I inserted the bad imports.

Haha.  So much for unit tests ;-)

There is something pretty bizarre about the imports, even in the
supposedly corrected code.

On my Windows7 machine I have to define unquote in the functions that
use it--doing so in the obvious place, right after importing urllib,
doesn't work.  Go figure.

Edward

-- 
You received this message because you are subscribed to the Google Groups 
leo-editor group.
To post to this group, send email to leo-editor@googlegroups.com.
To unsubscribe from this group, send email to 
leo-editor+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en.