I am trying to get the string value of a variable defined in a Python file and assign it to an elisp variable. The value is held in the variable org_file
in a file config.py
in the same directory as my elisp file. In the elisp file I have the following variable declaration (corgi
is the name of the Python package):
(defvar corgi-org-file-path
(shell-command-to-string "python -c \"from config import org_file; print org_file\"")
"Path to org file retrieved from python config file")
Now if I evaluate the shell-command-to-string
call alone, it returns the string path that I want. However, if I evaluate corgi-org-file-path
after it is defined, I get a Python Traceback in the messages buffer:
Traceback (most recent call last):
File \"<string>\", line 1, in <module>
ImportError: No module named config
I am not really sure what is happening here. What am I missing?