Smart Terminal Convert from 2.7 to 3.6

From OpenCircuits
Jump to navigation Jump to search

General

Not quite sure why I wrote this, but it does document what a conversion entails. Look at this for general info:

Exceptions


        except Exception, ex_arg:

change to

        except Exception as ex_arg:

Misc

I have been using () on print for some time but missed some, so fix

Missing modules

Queue

Fix

     import Queue
change to 
     import queue

Not


C:\Users\Russ>activate python3_spyder3

(python3_spyder3) C:\Users\Russ>conda install queue
Fetching package metadata ...........

PackageNotFoundError: Package not found: '' Package missing in current win-64 channels:
  - queue

Close matches found; did you mean one of these?

    queue: queuelib

You can search for packages on anaconda.org with

    anaconda search -t conda queue

(python3_spyder3) C:\Users\Russ>pip install queue
Collecting queue
  Could not find a version that satisfies the requirement queue (from versions: )
No matching distribution found for queue

(python3_spyder3) C:\Users\Russ>


Serial

Fix


(python3_spyder3) C:\Users\Russ>pip install pyserial
Collecting pyserial
  Downloading pyserial-3.3-py2.py3-none-any.whl (189kB)
    100% |████████████████████████████████| 194kB 811kB/s
Installing collected packages: pyserial
Successfully installed pyserial-3.3

(python3_spyder3) C:\Users\Russ>


pymysql

Fix

conda  install mysql   ???


(python3_spyder3) C:\Users\Russ>
(python3_spyder3) C:\Users\Russ>
(python3_spyder3) C:\Users\Russ>spyder
Spyder is already running. If you want to open a new
instance, please pass to it the --new-instance option

(python3_spyder3) C:\Users\Russ>pip install pyserial
Collecting pyserial
  Downloading pyserial-3.3-py2.py3-none-any.whl (189kB)
    100% |████████████████████████████████| 194kB 811kB/s
Installing collected packages: pyserial
Successfully installed pyserial-3.3

(python3_spyder3) C:\Users\Russ>conda  install mysql
Fetching package metadata ...........


PackageNotFoundError: Package not found: '' Package missing in current win-64 channels:
  - mysql

Close matches found; did you mean one of these?

    mysql: pymysql

You can search for packages on anaconda.org with

    anaconda search -t conda mysql



(python3_spyder3) C:\Users\Russ>conda  install pymysql
Fetching package metadata ...........
Solving package specifications: .

Package plan for installation in environment D:\apps\Anaconda\envs\python3_spyder3:

The following NEW packages will be INSTALLED:

    pymysql: 0.7.9-py36_0

Proceed ([y]/n)? y

pymysql-0.7.9- 100% |###############################| Time: 0:00:00   1.33 MB/s

(python3_spyder3) C:\Users\Russ>

Not









pyperclip

Fix

  File "D:\Russ\0000\spyder_3\SmartTerminal\gui.py", line 22, in <module>
    import  pyperclip

Not






   from    Tkinter import *   # is added everywhere since a gui assume tkinter namespace

ModuleNotFoundError: No module named 'Tkinter'

from    tkinter import *



<>  change to !=   or not( == )




        if port is not None:
             self.driver.port  = port


  File "D:\Russ\0000\spyder_3\SmartTerminal\rs232driver2.py", line 102, in __init__
    self.recData       = bytearray( "" )    # data that has been recieved.