Bottom Page

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
Quote
#2
look at six package: https://pypi.org/project/six/
It can be installed with pip
pip install six
Quote
#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

Quote
#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
Quote
#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
Quote
#6
You could define your variables before using them. That'd solve the issue.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  update certbot's python version metulburr 0 87 Sep-19-2019, 11:51 AM
Last Post: metulburr
  Im using python crash course version 2 james_newbie 3 86 Sep-07-2019, 09:21 PM
Last Post: ichabod801
  [split] Using this Python version of text2pdf jonsnow1221 1 221 May-07-2019, 07:48 PM
Last Post: micseydel
  Using this Python version of text2pdf Pedroski55 1 321 Apr-15-2019, 08:12 AM
Last Post: Pedroski55
  can't install package web in version python 3.7 a21250450 1 337 Mar-29-2019, 11:28 AM
Last Post: Larz60+
  Python Version on Mac OSX Sparkstorm 5 413 Feb-06-2019, 10:32 AM
Last Post: Sparkstorm
  Python version 3 that seems to be ignored by the system on a Raspberry Pi Discret68 3 501 Dec-28-2018, 06:42 PM
Last Post: Gribouillis
  How to comapare version UUIDs in python? swamyjrs 3 420 Dec-19-2018, 08:57 AM
Last Post: Gribouillis
  rpm version comparison in python asad 3 816 Jul-27-2018, 01:00 PM
Last Post: buran
  Python version change saisankalpj 4 902 Jul-19-2018, 05:24 PM
Last Post: buran

Forum Jump:


Users browsing this thread: 1 Guest(s)