Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: dieter Newsgroups: comp.lang.python Subject: Re: Finding .so files without setting LD_LIBRARY_PATH Date: Thu, 12 May 2016 09:08:35 +0200 Lines: 15 Message-ID: References: <1463002764.2579.26.camel@mad-scientist.net> <874ma3u51o.fsf@handshake.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.uni-berlin.de bWF/MxlyTY/MkzGd295KWwWPtYkkt4R7vSkifIgYouGg== Cancel-Lock: sha1:soPvRA6HTQ8JHLnZea08+lbv880= Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'fails.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:files': 0.09; 'subject:setting': 0.09; 'python': 0.10; 'python.': 0.11; 'example)': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'ssh': 0.16; 'fine,': 0.22; 'problem:': 0.22; 'subject: .': 0.22; "python's": 0.23; 'paul': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'finds': 0.29; 'invoke': 0.29; 'environment': 0.29; 'problem': 0.33; 'similar': 0.33; '(for': 0.34; 'but': 0.36; 'instead': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'charset:us-ascii': 0.37; 'means': 0.39; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'programs': 0.62; 'effective': 0.63; 'smith': 0.76 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: p57b38b57.dip0.t-ipconnect.de User-Agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <874ma3u51o.fsf@handshake.de> X-Mailman-Original-References: <1463002764.2579.26.camel@mad-scientist.net> Xref: csiph.com comp.lang.python:108541 Paul Smith writes: > ... > That works fine, but here's the problem: because LD_LIBRARY_PATH is in > Python's environment it is also passed down to programs invoked by > Python. That means if I (for example) invoke subprocess.call(['ssh', > ...]) then it fails because the system ssh is looking for the system > libcrypto.so, and when it finds the Python libcrypto.so instead > (because of LD_LIBRARY_PATH) it fails. I have had a similar problem - however with "PYTHONPATH" instead of "LD_LIBRARY_PATH". I solved it by removing "PYTHONPATH" from "os.environ" during Python startup. This way, the envvar "PYTHONPATH" was effective to set up "sys.path" but processes started from this python would not see it.