error: [Errno 2] No such file or directory: '~/.timed'
I followed the instructions to install timed:
sudo -H pip install timed
the installation show no error. then I tried to use it, but the following error shows up:
zsh: command not found: timed
using pip show timed shows the following result:
Name: timed
Version: 0.35
Summary: command-line time tracking
Home-page: http://adeel.github.com/timed
Author: Adeel Ahmad Khan
Author-email: [email protected]
License: BSD
Location: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
Requires: termcolor
after verifying both paths of executables for Python 2.7 and Python 3.6 are in .bash_profile
And using the following two commands to confirm the executable for "timed" is indeed installed in both locations:
cd /Library/Frameworks/Python.framework/Versions/2.7/bin
ls | grep timed
What am I doing wrong? Do I have to log-out & log-in or restart the computer after the installation?
Mac OS X 10.13.1 (17B1003)
just realised I am using iTerm, it have switched the default shell script to zsh instead of bash
after adding the two Python executable paths to .zshrc, using timed would show the following error:
error: [Errno 2] No such file or directory: '~/.timed'
only after using touch .timed to create an empty file, timed command would work as expected
Strange, that issue should have been fixed with https://github.com/adeel/timed/commit/de86965c5854142198f96b316aeae16dac08ed66.
in the official documentation for built-in function open():
Open file and return a corresponding file object. If the file cannot be opened, an OSError is raised.
'a' for appending (which on some Unix systems, means that all writes append to the end of the file regardless of the current seek position)
'+' open a disk file for updating (reading and writing)
it doesn't seem to offer the capability we need here, which is to create a file if none exists before.
The official documentation seems to be poor in this case, but "a+" does indeed create the file if it doesn't exist. See also this MO question.