【问题标题】:Interactive Python Execution in NPPNPP 中的交互式 Python 执行
【发布时间】:2019-02-27 14:47:54
【问题描述】:

我在this guide 之后对 NPP 进行了一系列调整,到目前为止一切顺利。

但我有一个有点烦人的问题。我想在我的代码中使用输入命令。

如果控制台关闭,这不是问题——它会弹出,我可以立即在输入字段中输入,很好,无需点击。

但是当我编辑代码并重新运行脚本(不关闭控制台)时,控制台会清除并运行程序,但我必须单击才能进行交互。

我不想每次完成脚本时都关闭 NppExec 控制台。

我不想每次运行脚本时都在控制台上单击。

作为奖励,我也不想每次再次运行我的脚本时都要杀死它。

我只想运行、输入所需的输入、返回编辑、重新运行、输入等,而不会中断,如果可能的话..

谁能帮我解决这个问题?

谢谢……

【问题讨论】:

    标签: python notepad++


    【解决方案1】:

    请查看 NppExec 手册以获取 NppExec 版本。 0.6 RC2。它在“4.6.4. Running Python & wxPython”部分中包含了一个可爱的脚本:

    npp_console -  // disable any output to the Console
    npp_save  // save current file (a .py file is expected)
    cd "$(CURRENT_DIRECTORY)"  // use the current file's dir
    set local @exit_cmd_silent = exit()  // allows to exit Python automatically
    set local PATH_0 = $(SYS.PATH)  // current value of %PATH%
    env_set PATH = $(SYS.PATH);C:\Python27  // use Python 2.7
    npp_setfocus con  // set the focus to the Console
    npp_console +  // enable output to the Console
    python -i -u "$(FILE_NAME)"  // run Python's program interactively
    npp_console -  // disable any output to the Console
    env_set PATH = $(PATH_0)  // restore the value of %PATH%
    npp_console +  // enable output to the Console
    

    命令

    npp_setfocus con
    

    看起来像您要找的那个。

    【讨论】:

    • 非常感谢!我会试一试!
    猜你喜欢
    • 2017-02-13
    • 1970-01-01
    • 2019-10-27
    • 1970-01-01
    • 2020-10-05
    • 1970-01-01
    • 2017-05-03
    • 1970-01-01
    • 2013-08-26
    相关资源
    最近更新 更多