“python: can't open file 'manage.py': [Errno 2] No such file or directory” when running tmux shell script?

核能气质少年 提交于 2019-12-13 03:15:16

问题


I am trying to run a very simple tmux shell script called "split.sh" which splits the terminal windows.

split.sh:

#!/bin/bash
~/build/tmux-1.5/tmux split-window -h
~/build/tmux-1.5/tmux split-window -v
~/build/tmux-1.5/tmux split-window -h

When I type the command "sh ~/build/tmux-1.5/split.sh", this shell script runs fine, splitting the terminal windows.

However, when I set an aliases,

alias sp='sh ~/build/tmux-1.5/split.sh'

and then run "sp", the terminal gives me a wierd error:

python: can't open file 'manage.py': [Errno 2] No such file

I believe this error with "manage.py" has something to do with Django.. but I have no idea why terminal is looking for manage.py. Why is the terminal giving me this error :(???

Thanks.


回答1:


I faced the same problem. 'manage.py' was in the directory but still was having this issue.

python: can't open file 'manage.py': [Errno 2] No such file or directory

What I did was that mentioned complete path to the project where manage.py was located like this and ran the command successfully! it's because the file was located in a subdirectory. You need to either enter the appropriate subdirectory or add it to the filename as I did below

python C:\Users\myuser\python_projects\myproject\manage.py syncdb

Hopefully that will help you to resolve the issue.



来源:https://stackoverflow.com/questions/17181942/python-cant-open-file-manage-py-errno-2-no-such-file-or-directory-when

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!