notepad++ a small improvement to build the Python development environment __python

Source: Internet
Author: User

Http://www.cnblogs.com/tt-0411/archive/2011/10/30/2229544.html

Notepad++ is a powerful editor with a set of configurations or plug-ins that can serve a variety of language development tasks, including Python. Search on the Internet "Python notepad++" can find a lot of results, I took the approach is this, this is the practice of most articles on the Internet: after opening a Python code file, press F5, open the "Run" dialog box, in the text box input cmd/k Python "$ (Full_current_path) "& ECHO. & PAUSE & EXIT, then click "Save", fill in a name, such as "Run with Python", configure the following shortcut keys, click OK. You can then run the Python file just by pressing the configured shortcut key or by clicking Run with Python on the running menu.

I used it for a couple of days and it felt good. And these two days in writing files, found that the program can run, no error, but theoretically should produce a file is still not found, instead of using Python idle to test the code, no problem, the resulting files are generated. After thinking about the working directory, use the following code to print the current working directory:

Import OS

Print OS.GETCWD ()

The

Displays the notepad++ installation directory and determines the problem with the working directory. Because previously used notepad++, know Shortcut.xml is configured user shortcut keys, opened to see, found that several parameters should be notepad++ itself, such as $ (Full_current_path), $ (npp_ DIRECTORY), $ (current_directory), and so on. This period of time intentionally or unintentionally looking at Windows script, the cmd command some simple understanding, on their own try to rewrite the running command: cmd/k CD "$ (current_directory)" &  Python $ (full_ Current_path) "& ECHO. & PAUSE & EXIT . Again using the above file test, this time the working directory shown is the directory where the file. It's no problem to try the program that writes the document again.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

Tags Index: