lp-shell disables importing of Python modules from '.'

Bug #1524777 reported by Dan Watkins
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lptools (Ubuntu)
New
Undecided
Unassigned

Bug Description

By the looks of it, the empty string is removed from PYTHONPATH/sys.path, meaning the current directory isn't searched. (I reproduced with both ipython and python for lp-shell, but went with consistent output for comparison here.)

$ ls
livefs_build.py

$ python
Python 2.7.10 (default, Oct 14 2015, 16:09:02)
[GCC 5.2.1 20151010] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import livefs_build
>>> import sys
>>> sys.path
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']

$ lp-shell production devel --python
Connected to LP service "https://api.launchpad.net/" with API version "devel":
Note: LP can be accessed through the "lp" object.
>>> import livefs_build
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ImportError: No module named livefs_build
>>> import sys
>>> sys.path
['/usr/bin', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.7', '/usr/lib/python2.7/dist-packages/ubuntu-sso-client']

ProblemType: Bug
DistroRelease: Ubuntu 15.10
Package: lptools 0.2.0-2
ProcVersionSignature: Ubuntu 4.2.0-16.19-generic 4.2.3
Uname: Linux 4.2.0-16-generic x86_64
ApportVersion: 2.19.1-0ubuntu5
Architecture: amd64
Date: Thu Dec 10 12:21:18 2015
EcryptfsInUse: Yes
InstallationDate: Installed on 2014-09-04 (462 days ago)
InstallationMedia: Ubuntu 14.04.1 LTS "Trusty Tahr" - Release amd64 (20140722.2)
PackageArchitecture: all
SourcePackage: lptools
UpgradeStatus: Upgraded to wily on 2015-10-21 (49 days ago)

Revision history for this message
Dan Watkins (oddbloke) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.