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
  How to find out from outside Python (in Windows) the current version of Python? pstein 5 2,255 Jun-28-2024, 07:02 AM
Last Post: Samuel34
  run part of a script with a different version of Python jdog 3 2,295 May-27-2024, 01:57 AM
Last Post: Alice12
  How to resolve version conflicts in Python? taeefnajib 0 2,034 Apr-27-2023, 08:37 PM
Last Post: taeefnajib
  Python venv and PIP version issue JanOlvegg 2 3,296 Feb-22-2023, 02:22 AM
Last Post: JanOlvegg
  Python Version upgrade nitinkukreja 1 1,695 Feb-04-2023, 10:27 PM
Last Post: Larz60+
  Can't update new python version on Pycharm GOKUUUU 6 7,762 Jul-23-2022, 09:24 PM
Last Post: GOKUUUU
  Building python (3.9.5) with different libexpat version (2.4.6) raghupcr 0 1,878 Feb-25-2022, 11:29 AM
Last Post: raghupcr
  Python keeps running the old version of the code quest 2 6,147 Jan-20-2022, 07:34 AM
Last Post: ThiefOfTime
  db migration(db version control) for python lubaz 2 3,738 May-30-2021, 01:36 PM
Last Post: lubaz
  Error on Python Version? ErnestTBass 6 4,687 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