From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Python source block and :dir header arg Date: Fri, 5 Apr 2019 10:34:53 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000007e79ad0585c964c9" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:37813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hCQ4F-0000at-1Z for emacs-orgmode@gnu.org; Fri, 05 Apr 2019 10:43:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hCPvv-00088b-Vx for emacs-orgmode@gnu.org; Fri, 05 Apr 2019 10:35:09 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:52755) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hCPvu-0007zv-Bv for emacs-orgmode@gnu.org; Fri, 05 Apr 2019 10:35:07 -0400 Received: by mail-wm1-x335.google.com with SMTP id a184so6939595wma.2 for ; Fri, 05 Apr 2019 07:35:05 -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" --0000000000007e79ad0585c964c9 Content-Type: text/plain; charset="UTF-8" I updated to the latest org, and I am not sure if you are seeing a bug. You might need to fix the space between : and session in your example, and name the session something. Also, you need to make sure the directory exists. This example works as expected for me: #+begin_src python :results output :session t :dir ./run import os cwd = os.getcwd() print("dir: ", cwd) #+end_src #+RESULTS: : dir: /Users/jkitchin/Box Sync/kitchingroup/jkitchin/journal/2019/04/05/run There are still some subtle possible issues, e.g. you cannot change the :dir after you run this in a session. I am not sure why. Personally I prefer ipython for sessions. 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 Wed, Apr 3, 2019 at 1:31 PM Joao Cortes wrote: > Thanks for checking. Do you know what to do now, assuming It is a bug? > > --0000000000007e79ad0585c964c9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I updat= ed to the latest org, and I am not sure if you are seeing a bug. You might = need to fix the space between : and session in your example, and name the s= ession something. Also, you need to make sure the directory exists. This ex= ample works as expected for me:

#+begin_src python :results output :session t :dir .= /run
import os
cwd =3D os.getcw= d()
print("dir: ", cwd)
#+end_src

#+RESULTS:
: dir:=C2=A0 /Users/jkitchin/Box Sync/kitchingroup/jkit= chin/journal/2019/04/05/run

There are still some subtle possible issues, e.g. you cannot change t= he :dir after you run this in a session. I am not sure why. Personally I pr= efer ipython for sessions.

John

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

On Wed, Apr 3, 2019 at 1:31 PM Joao Cortes <joaooneillcortes@outlook.pt= > wrote:
Than= ks for checking. Do you know what to do now, assuming It is a bug?

--0000000000007e79ad0585c964c9--