Python Forum
Python version compatability
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python version compatability
#1
Can we make a python code compatable with python version 2.7 and 3.3.right now my code is in 3.3
Reply
#2
look at six package: https://pypi.org/project/six/
It can be installed with pip
pip install six
Reply
#3
Depending on your code, there may not be much to fix. Often it's just a question of importing division and/or print_function from __future__, and maybe renaming raw_input as input if possible.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#4
(Nov-28-2018, 07:12 PM)ichabod801 Wrote: Depending on your code, there may not be much to fix. Often it's just a question of importing division and/or print_function from __future__, and maybe renaming raw_input as input if possible.

This is fine . But i have queries regarding the following points:
1.in python 3.3 i have used decode(utf-8).will this cause a problem. If so how can i solve it using six library
2.while running my python code in linux env,2.7,i got a error saying “global name windowsError not defined”.the same doesnt happen for 3.3.how do i solve this
Reply
#5
while running my python code in linux env,2.7,i got a error saying “global name windowsError not defined”.the same doesnt happen for 3.3.how do i solve this
Reply
#6
You could define your variables before using them. That'd solve the issue.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  run part of a script with a different version of Python jdog 2 395 Jan-09-2024, 08:49 PM
Last Post: jdog
  How to find out from outside Python (in Windows) the current version of Python? pstein 4 680 Oct-04-2023, 10:01 AM
Last Post: snippsat
  How to resolve version conflicts in Python? taeefnajib 0 873 Apr-27-2023, 08:37 PM
Last Post: taeefnajib
  Python venv and PIP version issue JanOlvegg 2 1,199 Feb-22-2023, 02:22 AM
Last Post: JanOlvegg
  Python Version upgrade nitinkukreja 1 854 Feb-04-2023, 10:27 PM
Last Post: Larz60+
  Can't update new python version on Pycharm GOKUUUU 6 3,708 Jul-23-2022, 09:24 PM
Last Post: GOKUUUU
  Building python (3.9.5) with different libexpat version (2.4.6) raghupcr 0 1,258 Feb-25-2022, 11:29 AM
Last Post: raghupcr
  Python keeps running the old version of the code quest 2 3,645 Jan-20-2022, 07:34 AM
Last Post: ThiefOfTime
  db migration(db version control) for python lubaz 2 2,700 May-30-2021, 01:36 PM
Last Post: lubaz
  Error on Python Version? ErnestTBass 6 3,421 Dec-09-2020, 04:02 PM
Last Post: ErnestTBass

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020