Python Forum
Migrating of python2 script to python3
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Migrating of python2 script to python3
#6
(Oct-05-2023, 12:41 PM)zuri Wrote: where should i run it? in cmnd prompt or on ide of pyth3?
From command line cmd,i use cmder but commands is the same.
Could also install 2to3,then if work from anywhere in cmd.
C:\
λ python --version
Python 3.11.3

C:\
λ pip -V
pip 23.2.1 from C:\python311\Lib\site-packages\pip (python 3.11)

C:\
λ pip install 2to3 --upgrade
Collecting 2to3
  Downloading 2to3-1.0-py3-none-any.whl (1.7 kB)
Installing collected packages: 2to3
Successfully installed 2to3-1.0

C:\
λ 2to3 --help
Usage: 2to3 [options] file|dir ...

Options:
  -h, --help            show this help message and exit
  -d, --doctests_only   Fix up doctests only
  -f FIX, --fix=FIX     Each FIX specifies a transformation; default: all
  -j PROCESSES, --processes=PROCESSES
                        Run 2to3 concurrently
  -x NOFIX, --nofix=NOFIX
                        Prevent a transformation from being run
  -l, --list-fixes      List available transformations
  -p, --print-function  Modify the grammar so that print() is a function
  -e, --exec-function   Modify the grammar so that exec() is a function
  -v, --verbose         More verbose logging
  --no-diffs            Don't show diffs of the refactoring
  -w, --write           Write back modified files
  -n, --nobackups       Don't write backups for modified files
  -o OUTPUT_DIR, --output-dir=OUTPUT_DIR
                        Put output files in this directory instead of overwriting the input files.  Requires -n.
  -W, --write-unchanged-files
                        Also write files even if no changes were required (useful with --output-dir); implies
                        -w.
  --add-suffix=ADD_SUFFIX
                        Append this string to all output filenames. Requires -n if non-empty.  ex: --add-
                        suffix='3' will generate .py3 files.
Reply


Messages In This Thread
Migrating of python2 script to python3 - by zuri - Oct-05-2023, 11:27 AM
RE: Migrating of python2 script to python3 - by snippsat - Oct-05-2023, 01:59 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Kivy App - Python3 script to Android app (opencv) jttolleson 7 3,735 Oct-19-2023, 01:11 PM
Last Post: MasCain
  Migration of Python2 and Python3 using Modernize and Future Rakshan 5 2,631 Oct-05-2023, 08:55 AM
Last Post: zuri
  Migrating data from oracle into postgres python_student 1 2,502 Feb-10-2022, 09:16 PM
Last Post: buran
  python2 python3 messed up : How to fix ? hary 15 8,212 Dec-30-2020, 08:26 PM
Last Post: hary
  Getting a small Python2 prog to run in Python3 steve140 4 3,976 Apr-19-2020, 09:27 AM
Last Post: steve140
  output mismatching when porting a python from python2 env to python3 env prayuktibid 2 2,639 Jan-21-2020, 04:41 AM
Last Post: prayuktibid
  python3 decoding problem but python2 OK mesbah 0 1,837 Nov-30-2019, 04:42 PM
Last Post: mesbah
  Migrating to Mysql from SQlite atari400 10 4,729 Nov-23-2019, 09:56 PM
Last Post: atari400
  Gnuradio python3 is not compatible python3 xmlrpc library How Can I Fix İt ? muratoznnnn 3 5,000 Nov-07-2019, 05:47 PM
Last Post: DeaD_EyE
  Trying to run a python2 script dagamer1991 3 2,593 Aug-12-2019, 12:33 PM
Last Post: buran

Forum Jump:

User Panel Messages

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