On the road to Python 3.x +

Development directions, tasks, and features being actively implemented or pursued by the development team.

On the road to Python 3.x +

Postby wirser » Sat Mar 30, 2019 5:17 pm

With compilable/runable VS (taose) the next project needs to be updating the python (used for the data) to version 3.x complient.

While still a rookie in python, I've decided to see if I can figure it out.

after cd into VS_root dir in terminal, I used this
Code: Select all
find ./ -name "*.py" >python.lst

to get a complete list of all python code, which will be used for project and other logging.

now learning that the "import" command is simular to #include in C/C++
using grep I did this next
Code: Select all
grep -R 'import ' */*.py  > ../py_imports_data

in the data folder to be able to make a sort of dependancy tree
I already noted one curious thing ,some modules being imported more than once in some files

next will be to use IDLE for python to verify all python modules needing checked
after that I may try to import older mods data
TecKnoledge available
Practical Wisdom for above TecKnoledge / back-ordered , lead time unknown
UPDATE: above shipment of Practical Wisdom for
TecKnoledge was lost in either luddite or kilrathie space - reward if found
wirser
Bounty Hunter
Bounty Hunter
 
Posts: 182
Topics: 27
Joined: Wed Dec 01, 2004 1:06 pm
Location: not where i want to be

Share On:

Share on Facebook Facebook Share on Twitter Twitter Share on Digg Digg

Re: On the road to Python 3.x +

Postby loki1950 » Sun Mar 31, 2019 9:51 am

For those extra import calls you might check the logical flow of those instances might be that they are in fact only used once :wink:

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 18/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and DELL E6400 4GB ram/100 GB HD Mint 17.3 6
User avatar
loki1950
The Shepherd
 
Posts: 5719
Topics: 51
Joined: Fri May 13, 2005 1:37 pm
Location: Ottawa

Re: On the road to Python 3.x +

Postby TBeholder » Sun Mar 31, 2019 12:09 pm

If only. Inside function definitions.
Code: Select all
def MakeMiningBar(concourse,concoursetext,background,bartext):
    import bar
    return bar.MakeBar(concourse,
            concoursetext,
            bartext,
            background,
            True,
            '0',
            False,
            '',
            (.87735,-.018),
            [],
            [
            (-0.8025, -1.055 , 0.5, .8),
            (-0.1725, -0.4558125, 0.1758125, 0.5385),
            #(-0.0325, -0.3558125, 0.1758125, 0.5385),
            ])
"Two Eyes Good, Eleven Eyes Better." -Michele Carter
User avatar
TBeholder
Elite Venturer
Elite Venturer
 
Posts: 745
Topics: 38
Joined: Fri Apr 14, 2006 7:40 pm
Location: chthonic safety

Re: On the road to Python 3.x +

Postby wirser » Mon Apr 01, 2019 6:19 pm

Like I said before I was at first looking a way map the python flow
I am not too worried about the imports just yet, still it looks wierd.
speaking of imports I need to find "VS" or some way to meet the requirement

doing a topic search for differences between python 2.x and 3.x point to 3+ changes
so far I've used search terms "xrange,print '"

the "print" seems simple enough to fix, just make
sure to enclose in () .if I understand the problem

the "xrange" I still have to study,it is used alot

There is a divison problem which may cause trouble , in short it causes wrong answers. so all of the math using division needs to be
checked. but the code should run just with bad math 8^0
TecKnoledge available
Practical Wisdom for above TecKnoledge / back-ordered , lead time unknown
UPDATE: above shipment of Practical Wisdom for
TecKnoledge was lost in either luddite or kilrathie space - reward if found
wirser
Bounty Hunter
Bounty Hunter
 
Posts: 182
Topics: 27
Joined: Wed Dec 01, 2004 1:06 pm
Location: not where i want to be

Re: On the road to Python 3.x +

Postby wirser » Tue Apr 16, 2019 12:14 pm

Ok I now have all print statements converted to print functions for python 3.x
I am still testing it but I have found out some interesting facts
there are 2 pdb.py and one bdb.py (supplied with python)
being I wasn't doing any debuging and have current versions of these I am going to have them deleted in the diff file I'll make.

I even found on a module comment about being an update for python 1.6 :o
Isuspect most if not all network modules can be updated

some comments said they wern't used anymore so I'm going to look into this before I create diff

BUGS
When trading Ive adopted a statagy of looking at all prices wether I needed them,giving me a better how to buy and/sell.
I have locked up more than once doing this :twisted: .
units.csv while present gives error about either missing or corrupt.
shader prob not python related.

Oh Loki I'd like to start a clean bug report/seperate tree for VS-taose bugs, but don't know if it should remain at sf or move to github or whereever.
TecKnoledge available
Practical Wisdom for above TecKnoledge / back-ordered , lead time unknown
UPDATE: above shipment of Practical Wisdom for
TecKnoledge was lost in either luddite or kilrathie space - reward if found
wirser
Bounty Hunter
Bounty Hunter
 
Posts: 182
Topics: 27
Joined: Wed Dec 01, 2004 1:06 pm
Location: not where i want to be

Re: On the road to Python 3.x +

Postby loki1950 » Tue Apr 16, 2019 1:55 pm

Might be easier to work on GitHub as that is where the taose source is and they have a bug tracking interface/template.

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 18/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and DELL E6400 4GB ram/100 GB HD Mint 17.3 6
User avatar
loki1950
The Shepherd
 
Posts: 5719
Topics: 51
Joined: Fri May 13, 2005 1:37 pm
Location: Ottawa

Re: On the road to Python 3.x +

Postby wirser » Sun Apr 21, 2019 2:52 pm

on bug tracker.
I am holding off on getting github accnr for now but will keep it in mind

About creating print diff's
I have created two diffs related to printing, one for data ond one for engine/objconv using "diff -ur"
However Due to changes in BB I can no longre upload/include them here :?
I used to be able to attach a file but not today

both use top folder as patch/diff root.(for the newbies, this is the directory that the diff and patch are issued from)

In addition I found that there is a problem with at least on python module (file) dealing with inconsistant indentation.
I figure more if not most of python code suffers this problem.
while python 2 gives warnings, python 3 gives errors.
I'm going to try to use "Idle" to try to correct these problems (I don't know if I can automate the process any, if not this will take some time). anyhow my next patch(es) will be for this then I'll attempt the xrange issue

if the code passes Idle for python 3 checks the final patch should be ready
wirser
Bounty Hunter
Bounty Hunter
 
Posts: 182
Topics: 27
Joined: Wed Dec 01, 2004 1:06 pm
Location: not where i want to be

Re: On the road to Python 3.x +

Postby loki1950 » Mon Apr 22, 2019 4:17 pm

My preferred Python IDE is Ninja not Idle but there maybe some scripts available on the official Python migration web sites.

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 18/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and DELL E6400 4GB ram/100 GB HD Mint 17.3 6
User avatar
loki1950
The Shepherd
 
Posts: 5719
Topics: 51
Joined: Fri May 13, 2005 1:37 pm
Location: Ottawa

Re: On the road to Python 3.x +

Postby wirser » Tue Apr 23, 2019 12:25 pm

HMM Ninja IDE is not in Debian Repos

But I did find the website
http://ninja-ide.org/
which has Debian/ubuntu pkgs and others, and has a seperate repository too

When I get some time I'll look at it, Idle isn't special, I just got intrduced to it working with my Raspberry pi.
To me IDE's do not mean much just yet ( I started using cp/m ed for a word processor back in the day).
Just do a search for python IDE (and get lost) :P

Thanks for the info btw
TecKnoledge available
Practical Wisdom for above TecKnoledge / back-ordered , lead time unknown
UPDATE: above shipment of Practical Wisdom for
TecKnoledge was lost in either luddite or kilrathie space - reward if found
wirser
Bounty Hunter
Bounty Hunter
 
Posts: 182
Topics: 27
Joined: Wed Dec 01, 2004 1:06 pm
Location: not where i want to be

Re: On the road to Python 3.x +

Postby wirser » Thu Apr 25, 2019 7:04 pm

Update:
I spent some time and checked all .py files in VS-taose tree with Idle for python 3.
aside from the print statements/functions I missed , most of the errors were simular (changing enclosing brackets and such)

indentations were next cause of errors (not properly set)
also declaring octal number with "0" allowed in python2 instead "0o" python3 demands, was common
.
I found out that the data/modules/builtin directory contains module supplied from python < ver 2.7, which got to "pass python 3 checks-, with usual errors

I tried running VS with "updated .py files and it behaves with differences eve3n though I am still using python 2.7 to execute.
what changes I made to get the python code to pass are supposed to work both on 2.7 and 3.5 versions so maybe I "fixed" some unknown problems. maybe Idle is tougher than the python interupter

I did not run into any "xrange" errors but maybe this is remidied by "_from-future__" module I found

Finally It seem to be fortunate I didn't post my print patches as I found mistakes with Idle

more to come
TecKnoledge available
Practical Wisdom for above TecKnoledge / back-ordered , lead time unknown
UPDATE: above shipment of Practical Wisdom for
TecKnoledge was lost in either luddite or kilrathie space - reward if found
wirser
Bounty Hunter
Bounty Hunter
 
Posts: 182
Topics: 27
Joined: Wed Dec 01, 2004 1:06 pm
Location: not where i want to be

Re: On the road to Python 3.x +

Postby wirser » Mon May 13, 2019 5:38 pm

today I got VS-taose to compile with python 3, and it even started

****KLUDGE ALERT ******
I had ran into a "Vega-py3" tree some time ago and tried using the c code from this to get a compile
but not even this did not work
searching for the source of the errors I can across a referrence to libboost_python.
In debian (I assume ubuntu) if you link to libboost_python you get linked to libboost_python2.7 and not the desired libboost_python-py3


to fix this after running cmake and ccmake edit /engine/build/CMakeCache.txt
change libboost_python.so to libboost_python-py35.so or whatever the correct libboost_python turns out to be .
Another cmake FIXME
it started but went straight to space and not sybase so needs more work

It looks like i'll see if I can get taose python /c interface working myself
TecKnoledge available
Practical Wisdom for above TecKnoledge / back-ordered , lead time unknown
UPDATE: above shipment of Practical Wisdom for
TecKnoledge was lost in either luddite or kilrathie space - reward if found
wirser
Bounty Hunter
Bounty Hunter
 
Posts: 182
Topics: 27
Joined: Wed Dec 01, 2004 1:06 pm
Location: not where i want to be

UPDATE On the road to Python 3.x +

Postby wirser » Sat May 18, 2019 7:09 am

Up until now I have been making changes that work with python 2.7 and 3.5 .

Now I have gotten to the point where to compile/run with python 3.5, changes must be made to about a dozen c++ files , which are not yet known to be backward compatable.
Of course the needed code deals with creating the "c++" modules needed by Python (3.5)
This has the effect of putting a player in a special "empty" universe :shock: with no way out ("Esc" then "Q" does exit cleanly)

When(if) I get a running python3 version I'll sttempt to code in some python version specific code

CMake side note
during my recompiling I run into a situation where cmake would not produce any file in my engine/build directory.
It turns out I started cmake/ccmake in the wrong directory and all of the output files were always put there afterwards .
in order to get cmake to work again like it is supposed< iha to delete CMakeFiles folder, CMakeCache.txt , cmake_install.cmake wherever they apper,. make sure you are in the seperate "build" and run cmake/ccmake again if you succeed you will have a proper Make file

Second for reasons not yet known to me, the :boost/python" lib path doesn' appear in ccmake until after successfully generating a Makefile (don't know why, but it needs to be changed for python3.x linking)
TecKnoledge available
Practical Wisdom for above TecKnoledge / back-ordered , lead time unknown
UPDATE: above shipment of Practical Wisdom for
TecKnoledge was lost in either luddite or kilrathie space - reward if found
wirser
Bounty Hunter
Bounty Hunter
 
Posts: 182
Topics: 27
Joined: Wed Dec 01, 2004 1:06 pm
Location: not where i want to be



Return to Engine Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron