#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2014
    Posts
    4
    Rep Power
    0

    Python library imports not working with TextMate


    Hello,

    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.

    Thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2009
    Posts
    522
    Rep Power
    34
    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.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2014
    Posts
    4
    Rep Power
    0
    Thanks,

    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. Reason: update

IMN logo majestic logo threadwatch logo seochat tools logo