Skip to main content
added 6 characters in body; edited tags
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 264

I'm defining a bash function in my .bash_profile so that I can run a certain Python script from any directory. My function is something like this:

func()
{
     python -i ~/Scripts/script.py
}

It works perfectly from my home directory, but it cant find the directory ./Scripts/script.py if run from anywhere else.

The error message is:

/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'Projects/sym.py': [Errno 2] No such file or directory

Shouldn't the ~ initially direct to the home directory anyways?

I'm defining a bash function in my .bash_profile so that I can run a certain Python script from any directory. My function is something like this:

func()
{
     python -i ~/Scripts/script.py
}

It works perfectly from my home directory, but it cant find the directory ./Scripts/script.py if run from anywhere else.

The error message is:

/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'Projects/sym.py': [Errno 2] No such file or directory

Shouldn't the ~ initially direct to the home directory anyways?

I'm defining a bash function in my .bash_profile so that I can run a certain Python script from any directory. My function is something like this:

func()
{
     python -i ~/Scripts/script.py
}

It works perfectly from my home directory, but it cant find the directory ./Scripts/script.py if run from anywhere else.

The error message is:

/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'Projects/sym.py': [Errno 2] No such file or directory

Shouldn't the ~ initially direct to the home directory anyways?

added 4 characters in body; edited body
Source Link
techraf
  • 6.1k
  • 11
  • 36
  • 51

I'm makingdefining a bash function in my .bash_profile.bash_profile so that I can run a certain pythonPython script from any directory. My function is something like this:

func()
{
     python -i ~/Scripts/script.py
}

It works perfectly from my home directory, but it cant find the directory ./Scripts/script.py if run from anywhere else.

The error message is:

/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'Projects/sym.py': [Errno 2] No such file or directory

Shouldn't the ~ initially direct to the home directory anyways?

I'm making a bash function in my .bash_profile so that I can run a certain python script from any directory. My function is something like this:

func()
{
     python -i ~/Scripts/script.py
}

It works perfectly from my home directory, but it cant find the directory ./Scripts/script.py if run from anywhere else.

The error message is:

/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'Projects/sym.py': [Errno 2] No such file or directory

Shouldn't the ~ initially direct to the home directory anyways?

I'm defining a bash function in my .bash_profile so that I can run a certain Python script from any directory. My function is something like this:

func()
{
     python -i ~/Scripts/script.py
}

It works perfectly from my home directory, but it cant find the directory ./Scripts/script.py if run from anywhere else.

The error message is:

/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'Projects/sym.py': [Errno 2] No such file or directory

Shouldn't the ~ initially direct to the home directory anyways?

added 210 characters in body; edited title; deleted 5 characters in body
Source Link
techraf
  • 6.1k
  • 11
  • 36
  • 51

Run pythonPython script from anywhere

I'm making a bash function in my .bash_profile so that I can run a certain python script from any directory. My function is something like this:

func()
{
     python -i ~/Scripts/script.py
}

It works perfectly from my home directory, but it cant find the directory ./Scripts/script.py if run from anywhere else.

The error message is:

/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'Projects/sym.py': [Errno 2] No such file or directory

Shouldn't the ~ initially direct to the home directory anyways? Thank you.

Run python script from anywhere

I'm making a bash function in my .bash_profile so that I can run a certain python script from any directory. My function is something like this:

func()
{
     python -i ~/Scripts/script.py
}

It works perfectly from my home directory, but it cant find the directory ./Scripts/script.py if run from anywhere else. Shouldn't the ~ initially direct to the home directory anyways? Thank you.

Run Python script from anywhere

I'm making a bash function in my .bash_profile so that I can run a certain python script from any directory. My function is something like this:

func()
{
     python -i ~/Scripts/script.py
}

It works perfectly from my home directory, but it cant find the directory ./Scripts/script.py if run from anywhere else.

The error message is:

/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'Projects/sym.py': [Errno 2] No such file or directory

Shouldn't the ~ initially direct to the home directory anyways?

Source Link
Loading