1

I'm trying the Python example from the org-babel website which looks the following:

#+begin_src python :session
def foo(x):
    if x>0:
        return x+1
    else
        return x-1

foo(1)
#+end_src

While invocing C-c C-c I get the follwing error in the Minibuffer:

Searching for program: permission denied, python

I don't know why and how to fix it.

My current setup is the following: I'm runnig Windows 7 and cygwin. I've installed emacs via cygwin and stated it via emacs & in cygwin. I already tried editing some variables inside emacs, without effect, such as: (setq python-python-command "c:/Python27/python.exe")

beyeran
  • 885
  • 1
  • 8
  • 26

3 Answers3

2

Sounds like your python program is not executable -- does not have execute permission. Go to its folder and change the permissions to include execute. You can do that using Windows Explorer, but you must be logged in as an administrator. You might be able to do it also from Emacs, in Dired, using M (command dired-do-chmod).

Actually, it sounds like the program python is not in your exec-path. Ensure that it is there. One way or the other, the problem is that Emacs is not finding an executable file named python in your exec-path.

Drew
  • 29,895
  • 7
  • 74
  • 104
  • This changed nothing to the problem. – beyeran Jan 11 '14 at 19:00
  • The folder also needs to allow this possibility, of course. The error message is telling you that `python` is not recognized as an executable program. Other permission problems could also mean that, besides `execute` permission. See `file-error` in the Elisp manual, node `Standard Errors`. The code raising the error is in function `start-process`, in file `process.c`. – Drew Jan 11 '14 at 19:38
1

Before org-mode will execute a code block, the language of that block must be enabled. Try this:

(org-babel-do-load-languages
 'org-babel-load-languages
 '((python . t)))
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257
1

For this context in Windows, "Permission denied" from Emacs typically means that the executable file was not found. Usually this is due to the executable not being on the Windows Path. Adding the location of the executable [C:\python27] to the Path ought to fix it.

You can follow these instructions to access the Path:

http://www.java.com/en/download/help/path.xml

With pictures:

http://www.faqforge.com/windows/setting-the-path-environmental-variable-on-windows-7/

Using PowerShell:

https://stackoverflow.com/a/1333717/2101909

Community
  • 1
  • 1
ben rudgers
  • 3,647
  • 2
  • 20
  • 32