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


Groups > comp.lang.python > #55373 > unrolled thread

Re: Running code from source that includes extension modules

Started byMichael Schwarz <michi.schwarz@gmail.com>
First post2013-10-02 20:42 +0200
Last post2013-10-02 20:42 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#55373 — Re: Running code from source that includes extension modules

FromMichael Schwarz <michi.schwarz@gmail.com>
Date2013-10-02 20:42 +0200
SubjectRe: Running code from source that includes extension modules
Message-ID<mailman.647.1380739372.18130.python-list@python.org>

[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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web