Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #55373

Re: Running code from source that includes extension modules

Path csiph.com!usenet.pasdenom.info!gegeweb.org!newsfeed0.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.83.MISMATCH!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <michi.schwarz@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'output': 0.05; 'debug': 0.07; 'subject:code': 0.07; "'.'": 0.09; 'subject:modules': 0.09; 'python': 0.11; 'assume': 0.14; "wouldn't": 0.14; '"michael': 0.16; 'backwards': 0.16; "module's": 0.16; 'module?': 0.16; 'subdirectory': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'module': 0.19; 'command': 0.22; 'import': 0.22; 'to:name:python- list@python.org': 0.22; 'directory.': 0.24; 'fine': 0.24; 'source': 0.25; 'extension': 0.26; 'mention': 0.26; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'michael': 0.29; "doesn't": 0.30; "i'm": 0.30; 'included': 0.31; 'code': 0.31; 'received:10.0.0': 0.31; 'subject:that': 0.31; 'run': 0.32; 'linux': 0.33; 'running': 0.33; 'subject:from': 0.34; 'problem': 0.35; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; "didn't": 0.36; 'charset:us-ascii': 0.36; 'received:10.0': 0.36; 'list': 0.37; 'received:10': 0.37; 'message-id:@gmail.com': 0.38; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'manually': 0.60; 'mentioned': 0.61; 'header:Message-Id:1': 0.63; 'telling': 0.64; 'convinced,': 0.84; 'directory:': 0.84; 'subject:source': 0.84; 'differences': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:message-id :references:to; bh=pFA1oXzl53Rm0p4Pmauc2oCkpLNdIAiItvpOZ72BAaE=; b=PJH8siuGKR/7xvLs1zzhCFFYfZxAUO5pAEGOXcHjuDoZeEnbuYz2zkUVPTsTJ38q75 HOTeVHD1PcYH+m0w/fYOqtPlyg/vf+jmhf4NzxpbzS9IKdYHSdvSIeV3JUb3AFj6HNCS Tu/QD+Em4IlgrDogrbax8TAppG7gU8Bc95Qj9LRx9yOoeWyEnbSVOZSjCYLg7kaDTn2U yugwXs/M4qfLF/YvyZirj3cAuo/PC/se7Licrgx0rfFQGId0q7EJYIkKQbvSUMVu/aTH PL3b4ZkF5dBxhD8yCuG7+OOktD3Am1HCeF9y/ViMFIh3jwc0TJNTuGRTMaTI+JOgVaqJ 3ToQ==
X-Received by 10.14.126.69 with SMTP id a45mr5208667eei.65.1380739370378; Wed, 02 Oct 2013 11:42:50 -0700 (PDT)
Content-Type multipart/signed; boundary="Apple-Mail=_2ACD5EB0-59D6-4DBD-87CA-FDEBD14C489D"; protocol="application/pkcs7-signature"; micalg=sha1
Mime-Version 1.0 (Mac OS X Mail 6.6 \(1510\))
Subject Re: Running code from source that includes extension modules
From Michael Schwarz <michi.schwarz@gmail.com>
X-Priority 3
In-Reply-To <C3C8E6C3C22C46268786D02E27C5C170@dev.null>
Date Wed, 2 Oct 2013 20:42:46 +0200
References <CABdB9Z4rvKmO0bdZrmBd4Cy6b1OJyzkFMNpwmrR=k55J1X39wg@mail.gmail.com> <C3C8E6C3C22C46268786D02E27C5C170@dev.null>
To "python-list@python.org" <python-list@python.org>
X-Mailer Apple Mail (2.1510)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.647.1380739372.18130.python-list@python.org> (permalink)
Lines 89
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1380739372 news.xs4all.nl 16001 [2001:888:2000:d::a6]:48180
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:55373

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On 2013-W40-3, at 19:15, "Gisle Vanem" <gvanem@yahoo.no> wrote:

> "Michael Schwarz" <michi.schwarz@gmail.com> wrote:
> 
>> So how do I run my code so it will find the built extension module? Do I
>> pass the output directory on the command line manually or is there some
>> other solution? I would like to still be able to run the code from the
>> source directory as I'm using PyCharm to edit and debug the code.
> 
> Doesn't Python on Linux (I assume that since you mentioned the module's .so)
> support having current-dir '.' in $PYTHONPATH? Works fine on Windows.

I'm running OS X 10.8 and Python 3.2, sorry I didn't mention it. But I assume the differences to Linux are minimal.

The current directory is included in sys.path, otherwise I wouldn't be able to import modules in the same directory. But the problem is that the built extension module is in a subdirectory of the "build" directory:

$ find -name '*.so'
./build/lib.macosx-10.8-x86_64-3.2/_foo.so

And so I can't import it without manually adding that directory to sys.path. I'm convinced, someone on this list can shout at me, telling me that I got it completely backwards and that there's a straightforward and intuitive way to develop extension modules!

Michael

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Running code from source that includes extension modules Michael Schwarz <michi.schwarz@gmail.com> - 2013-10-02 20:42 +0200

csiph-web