0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

f8: python 2.x -> 3.x 移行エラー メモ (pythonista)

Last updated at Posted at 2020-01-09

.

以前の以下記事

f5: Pythonista でメール送信
https://qiita.com/cxfgp/items/4849a856be57646bcf34
f6: Pythonista で LINE メッセージ送信
https://qiita.com/cxfgp/items/bb82b4ce7b7af000bd6f

で、

#####※ Pythonista v3 未確認(多分いけると思います)#####

と書き、3.x 的機能は使用していない意味でしたが、
実際に移行をしてみての 「つまずき箇所」 メモです

ほぼ皆さまが「移行」で体感している部分と思います


[ 1. キッチン ]

Pythonista v2.1.1
Pythonista v3.2

iphone SE / ios 13:2.3
iphone 8 / ios 12.3.1
iphone 11 / ios 13.3


[ 2. 調理 ]

1) SyntaxError: Missing parentheses in call to 'print'

v2.1.1
print 'abc'

v3.2
print ('abc')

2) ModuleNotFoundError: No module named 'email.MIMEText'

v2.1.1
import smtplib
from email.MIMEText import MIMEText
from email.Utils import formatdate
from email.Header import Header

v3.2
import smtplib
from email.mime.text import MIMEText
from email.utils import formatdate
from email.header import Header

3) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe3

    for linm in linef:
    /ascii.py", line 27, in decode
    return codecs.ascii_decode(input, self.errors)[0]

v2.1.1
with open(cpedf3 + cpedf1) as linef:

v3.2
with open(cpedf3 + cpedf1, encoding='UTF-8') as linef:

4) NameError: name 'raw_input' is not defined

v2.1.1
choice = raw_input("'yes' or 'no' [y/n]: ").lower()

v3.2
choice = input("'yes' or 'no' [y/n]: ").lower()


.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?