You are not logged in.

#1 2017-05-15 16:42:17

end222
Member
Registered: 2017-04-05
Posts: 3

[Solved] Can't manage to get Python 2 working instead of Python 3

I am trying to use the porting tool offered by Meizu to port Flyme to non-Meizu phones and I am getting some errors related to Python.

The program (great part of it) is written in Python 2 because when using print there are no parenthesis.

The problem is that when I try to execute the program I get some errors related to the lack of parenthesis when using print. The problem persists even when using virtualenv2.

I have also tried linking python 2 to my home directory as suggested in the wiki and adding that directory to the path but it did not work either. However, whenever I execute "python -V" it tells me that I am using Python 2.

Last edited by end222 (2017-05-15 17:45:23)

Offline

#2 2017-05-15 17:02:07

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,858
Website

Re: [Solved] Can't manage to get Python 2 working instead of Python 3

What errors are you getting?

Mod note: moving to NC


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2017-05-15 17:38:26

end222
Member
Registered: 2017-04-05
Posts: 3

Re: [Solved] Can't manage to get Python 2 working instead of Python 3

It just tells me that the parenthesis are missing so I assume that it is trying to run the script with Python 3 instead of Python 2. Also, the problem is not from the program as I executed it in Ubuntu with Python 2.7.12 and it worked well

Offline

#4 2017-05-15 17:42:53

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,553

Re: [Solved] Can't manage to get Python 2 working instead of Python 3

How are you running it? "python2 <program>" should work fine.

Offline

#5 2017-05-15 17:44:41

end222
Member
Registered: 2017-04-05
Posts: 3

Re: [Solved] Can't manage to get Python 2 working instead of Python 3

Mark it as solved, I managed to get it working!

What I did is chaging the first line of the script by putting:
#!/usr/bin/python2

It worked like a charm.

Thanks for the answers big_smile

Offline

Board footer

Powered by FluxBB