3

Following this for my ~/.pystartup and adding export PYTHONSTARTUP="~/.pystartup" to my .bash_profile. After I open a new terminal, and fire up python I get

Python 2.7.10 (default, Jul 14 2015, 19:46:27) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Could not open PYTHONSTARTUP
IOError: [Errno 2] No such file or directory: '~/.pystartup'

~/pystarup definitely exists. I also would like vi key bindings and when I put set editing-mode vi in my ~/.inputrc, I still do NOT get the appropriate bindings.

I am working on OSX 10.10.5. How do I fix these issues?

Takis
  • 726
  • 5
  • 11
irritable_phd_syndrome
  • 4,631
  • 3
  • 32
  • 60
  • 1
    I'm not sure whether Python is as smart as BASH or any other shell to recognize `~/file` as `file` being stored in your home directory. Try to provide a full path to your `.pystartup` file. – ForceBru Dec 12 '15 at 11:24
  • Yes you are right on that. That fixes my finding of the ~/.pystartup. However that still leaves the mystery of why my vi key bindings don't work. – irritable_phd_syndrome Dec 12 '15 at 11:27

1 Answers1

2

Since my comment helped the OP, I'm gonna copy it here: Python doesn't seem to recognize shell-specific features like ~ replaced with the Home directory, so it's better to manually replace ~ with the full path to the home directory in this case.

Speaking about .inputrc problems: Mac OS doesn't even use it. Instead, you should use your ~/.editrc. So, you can run man editor to get more information. See this SO answer for more information on this topic.

Community
  • 1
  • 1
ForceBru
  • 43,482
  • 10
  • 63
  • 98