February 27th, 2014, 07:06 PM
Python library imports not working with TextMate
Some of my import statements work with TextMate, some do not.
I'm on a Mac. I just downloaded the latest version of Python. But then when I open up terminal, it says python version 2.7.5
I would like to have TextMate fully recognize all of the python standard imports, and to have my system consistently up-do-date with Python 3.x. I want my system to never know Python 2.x existed. I'm a new Python programmer with zero legacy concerns. So I want to start and stay cleanly in Python 3.x
Could someone tell me what I need to do to sort this out?
TextMate is recognizing import time, and import turtle. But then it does not recognize import urllib.request, and it does not recognize anything related to tkinter.
I don't know if its TextMate or my Python set up (or both) that is causing this.
February 27th, 2014, 09:11 PM
I would suggest the Mac forum for this. Other programs in the operating system possibly use Python 2.x, on some systems the software install/upgrade program is written in Python 2.x, so I would not delete it until you know for sure. Python 3.x can be installed alongside of 2.x, but you have to explicitly call 3.x in the shebang line and maybe change the PYTHONPATH variable. I'm not a Mac user so don't know, but there should be posts about this on the Mac forum already as Python3.x has been around for years.
February 28th, 2014, 01:39 AM
I actually got them to work it looks like:
import urllib instead of import urllib.request
import Tkinter instead of tkinter
It's a 2013 college textbook. But the fact that two of the four imports that I typed directly from the textbook didn't work "straight out of the box" is not a good batting average!
Last edited by codePracticer; February 28th, 2014 at 01:43 AM.