for letter in 'abcdefg') >>> next(my_generator) >>> my_generator.next() ‘b’ # Python 3.6.5 >>> my_generator = (letter for letter in 'abcdefg') >>> next(my_generator) ‘a’ >>> my_generator.next() … AttributeError: 'generator' object has no attribute 'next'
>>> i = 1 >>> print ‘before: i=’, i before: i = 1 >>> ‘comprehension: ‘, [i for i in range(5)] comprehension: [0, 1, 2, 3, 4] >>> print ‘after: i = ‘ i after: i = 4 # Python 3.6.5 >>> i = 1 >>> print(‘before: i =’, i) before: i = 1 >>> print(‘comprehension:’, [i for i in range(5)]) comprehension: [0, 1, 2, 3, 4] >>> print(‘after: i=’, i) after i = 1
Python 3? ◦ 4 packages aren’t supported. (excluded `futures`) ◦ Incf-countryutils We use this lib for finding region of each country. We can replace this lib with `pycountry_convert` $ pip install caniusepython3 $ caniusepython3 -r requirements.txt … Finding and checking dependencies ... You need 3 projects to transition to Python 3. Of those 3 projects, 3 have no direct dependencies blocking their transition: incf-countryutils pyslack pyvimeo ratelim
Python 3? ◦ pyslack We can replace this lib with `slackclient` $ pip install caniusepython3 $ caniusepython3 -r requirements.txt … Finding and checking dependencies ... You need 3 projects to transition to Python 3. Of those 3 projects, 3 have no direct dependencies blocking their transition: pyslack pyvimeo ratelim
Python 3? ◦ pyvimeo Upgrade 0.3.9 to 1.0.2 (pyvimeo not official library of python3, but we can use it ◦ latelim Same with pyvimeo (in doc, “Works in Py2 and Py3.”) => https://github.com/vimeo/vimeo.py/pull/47 $ pip install caniusepython3 $ caniusepython3 -r requirements.txt … Finding and checking dependencies ... You need 3 projects to transition to Python 3. Of those 3 projects, 3 have no direct dependencies blocking their transition: pyvimeo ratelim
to python 3 ◦ 2to3 Automated code translation tool • First run! And fix it! => follow Fabric’s doc, we have to use fabric3 $ fab run … File "/Users/mireulim/.virtualenvs/adserver-python3/bin/fab", line 11, in <module> ... ImportError: cannot import name 'isMappingType'
[localhost] local: python manage.py runserver 0.0.0.0:9001 2018-06-19 09:28:32,003 [14823] [INFO] Found credentials in environment variables. 2018-06-19 09:28:32,131 [14823] [INFO] Raven is not configured (logging is disabled). Please see the documentation for more information. 2018-06-19 09:28:33,354 [14833] [INFO] Found credentials in environment variables. 2018-06-19 09:28:33,474 [14833] [INFO] Raven is not configured (logging is disabled). Please see the documentation for more information. Performing system checks... System check identified no issues (0 silenced). June 19, 2018 - 09:28:35 Django version 1.10.8, using settings 'lockjoy.settings' Starting development server at http://0.0.0.0:9001/ Quit the server with CONTROL-C.
• Pycurl error in macos => https://cscheng.info/2018/01/26/installing-pycurl-on-macos-high-sierra.html • ‘DynamicClassAttribute’ object don’t have ‘value’ attribute in python3 • from sets import Set ⇒ set • string objects don’t have decode() method in python3 • check all changes files generated by 2to3 with => https://docs.python.org/3/howto/pyporting.html#pyporting-howto • Import current folder’s files: from strings_jp import * => from .strings_jp import *