From: Jack Kamm <email@example.com> To: Joost Kremers <firstname.lastname@example.org>, email@example.com Subject: Re: ob-python: import local package into a session Date: Mon, 23 Nov 2020 08:20:04 -0800 [thread overview] Message-ID: <firstname.lastname@example.org> (raw) In-Reply-To: <email@example.com> Hi Joost, > What I'm trying to do is to import a Python file with a bunch of utility > functions into the ob-python session. I thought this might be possible if I'd > structure my code as a regular Python package, because that works if I want to > import my utility functions into another Python file. But it doesn't seem to > work for the ob-python session. You need to make sure your module is either in the working directory you started the Python session in, or in your PYTHONPATH, for example by adjusting os.env["PYTHONPATH"] before attempting to import the module. This shouldn't be ob-python or even Emacs specific. You can test whether things work by typing "python" in the terminal and attempting to import your module. By the way, are you using IPython or vanilla Python? I recently encountered an issue trying to import modules through a symlink in IPython, whereas it worked perfectly fine in a vanilla Python session. Jack
next prev parent reply other threads:[~2020-11-23 16:21 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-11-23 15:46 Joost Kremers 2020-11-23 16:03 ` John Kitchin 2020-11-23 16:20 ` Jack Kamm [this message] 2020-11-23 16:21 ` Jack Kamm 2020-11-23 22:47 ` Joost Kremers 2020-11-24 12:23 ` Maxim Nikulin 2020-11-24 13:35 ` Joost Kremers 2020-11-24 14:24 ` Jack Kamm 2020-11-24 18:40 ` Tom Gillespie 2020-11-25 12:58 ` Joost Kremers
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: https://www.orgmode.org/ * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: ob-python: import local package into a session' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this inbox: https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).