I requested over on Stack Overflow, however this appears an issue particular to Mac OS X because the error doesn’t occur on different OS (ubuntu for instance).
https://stackoverflow.com/q/42637680/447830 repeated beneath:
So. I personal the file named ~/.osc_history, as proven beneath:
$ w
17:53 up 3:15, 5 customers, load averages: 1.30 1.17 1.10
USER TTY FROM LOGIN@ IDLE WHAT
kyma console - 14:39 3:14 -
kyma s001 - 17:20 - w
$ ls -l ~/.osc_history
-rw-r--r-- 1 kyma employees 13 Mar 6 17:41 /Customers/kyma/.osc_history
$ ls -lO ~/.osc_history
-rw-r--r-- 1 kyma employees - 13 Mar 6 17:41 /Customers/kyma/.osc_history
The header within the file is appropriate:
$ cat ~/.osc_history
_HiStOrY_V2_
From the interactive immediate, the next code runs effective:
$ python
Python 2.7.10 (default, Jul 30 2016, 19:40:32)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Sort "assist", "copyright", "credit" or "license" for extra info.
>>> import os.path
>>> import readline
>>> histfile = os.path.be a part of(os.path.expanduser("~"), ".osc_history")
>>> histfile
'/Customers/kyma/.osc_history'
>>> readline.read_history_file(histfile)
>>> ^D
Nonetheless, once I try to run the next, which I’ve known as “yeuch.py”…
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import readline # Command line historical past
import os.path
histfile = os.path.be a part of(os.path.expanduser("~"), ".osc_history")
if not os.path.isfile(histfile): # If there isn't any historical past file...
empty = open(histfile, "a") # ... create an ALMOST empty one...
empty.write("_HiStOrY_V2_n") # ... with the particular header line
empty.shut()
readline.read_history_file(histfile) # Learn historical past from earlier periods
readline.set_history_length(1000) # Default size was -1 (infinite)
…I see:
$ python yeuch.py
Traceback (most up-to-date name final):
File "yeuch.py", line 14, in
readline.read_history_file(histfile) # Learn historical past from earlier periods
IOError: [Errno 1] Operation not permitted
What the heck’s happening? (I hope I am not overlooking some silly typo a number of instances and am not a readline code professional sufficient to identify the error myself.)