Setting current directory for Interactive Console in pydev (Eclipse) at console startup

安稳与你 提交于 2019-12-08 00:27:44

问题


I want to start an interactive console in pydev from project directory, in order to import an app. I tried to use os.chdir at startup from Window->Preferences->PyDev->Interactive Console->Initial interpreter commands. I read https://docs.djangoproject.com/en/dev/ref/settings/ searching for an entry to set path but I didn't find anything. Thanks

Edit: I had to import module first in order to import app


回答1:


Strange, I must say that after changing the initial interpreter commands to be:

import sys; print('%s %s' % (sys.executable or sys.platform, sys.version))
import os;os.chdir('c:\\')

Later doing (in the shell):

import os.path
os.path.abspath('.')

Does show the expected path... Aren't you getting that? What do you get when you do the abspath('.') in the shell after the startup?



来源:https://stackoverflow.com/questions/10319980/setting-current-directory-for-interactive-console-in-pydev-eclipse-at-console

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