From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Python source block and :dir header arg Date: Mon, 1 Apr 2019 14:12:46 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000006ef67405857bf8d8" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:38592) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hB1Qc-0000kl-7r for emacs-orgmode@gnu.org; Mon, 01 Apr 2019 14:13:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hB1Qb-0008H6-78 for emacs-orgmode@gnu.org; Mon, 01 Apr 2019 14:13:02 -0400 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:39170) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hB1Qa-0008GQ-K3 for emacs-orgmode@gnu.org; Mon, 01 Apr 2019 14:13:01 -0400 Received: by mail-wm1-x332.google.com with SMTP id n25so434509wmk.4 for ; Mon, 01 Apr 2019 11:13:00 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Joao Cortes Cc: "emacs-orgmode@gnu.org" --0000000000006ef67405857bf8d8 Content-Type: text/plain; charset="UTF-8" You might need to provide some additional information about your setup (org-version, etc.). This works for me in org 9.1.9. John ----------------------------------- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu On Mon, Apr 1, 2019 at 1:07 PM Joao Cortes wrote: > Consider the following python source block, > > #+begin_src python :results output : session :dir ./run > import os; > cwd = os.getcwd() > print(cwd) > #+end_src > > The dir header arg should change the directory used to run the session, > in this case to the directory "../base/run", where "base" is the parent > directory the file visited by the current buffer. Instead, I get > "../base". Is this a bug? > > Thank you > Joao Cortes > > --0000000000006ef67405857bf8d8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
You might need to provide some additional information abou= t your setup (org-version, etc.). This works for me in org 9.1.9.

John

---= --------------------------------
Professor John Kitchin=C2=A0
Doherty= Hall A207F
Department of Chemical Engineering
Carnegie Mellon Univer= sity
Pittsburgh, PA 15213
412-268-7803

On Mon, Apr 1, 2019 at 1:07 PM Joao Cortes <joaooneillcortes@outlook.pt> wrote:
Consider the following= python source block,

#+begin_src python :results output : session :dir ./run
=C2=A0 =C2=A0 =C2=A0 =C2=A0 import os;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 cwd =3D os.getcwd()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 print(cwd)
#+end_src

The dir header arg should change the directory used to run the session,
in this case to the directory "../base/run", where "base&quo= t; is the parent
directory the file visited by the current buffer. Instead, I get
"../base". Is this a bug?

Thank you
Joao Cortes

--0000000000006ef67405857bf8d8--