Tips for developing python with notepad

1. Directly on the notepad, press F5 to run the python program

I've been working on python recently, and today I found that notepad can run python programs directly with F5, which is very convenient.

Available for a while and found that an error was reported, a file could not be found? But I can run it directly under dos right? 

Later I found out the reason, because I used a relative directory, running under dos, the current directory is the directory of the python file

And I am running under notepad, the current directory is the directory where notepad.exe is located

 

Solution:

a. At the beginning of the run road, I set it to be 

cmd /k python "$(FULL_CURRENT_PATH)" & ECHO. & PAUSE & EXIT 

b. Because the notepad.exe and .py files are not in the same directory, they should be changed to

cmd /k cd "$(CURRENT_DIRECTORY)" & python "$(FULL_CURRENT_PATH)" & ECHO. & PAUSE & EXIT 

c. It is said on the Internet that the notepad.exe and .py files are not in the same partition, and it does not work. It is said to be changed to this

cmd /k e: & cd "$(CURRENT_DIRECTORY)" & python "$(FULL_CURRENT_PATH)" & ECHO. & PAUSE & EXIT

Ok, you're done, the spirit of sharing on the Internet is amazing!

 

Reference sticker:

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

http://www.cnblogs.com/zhcncn/p/3969419.html

 

 

 

2. Jump to the place where the function is defined on the notepad

Writing programs on notepad is really a bit dizzy and can't jump to a function or variable

Later, I found out that I didn't know it, just install a SourceCookifier plug-in, refer to the post:

https://my.oschina.net/jiangwave/blog/127448

 

3. Solve the error of 'utf-8' codec can't decode byte 0xce

Check whether the file is UTF-8 encoded, generally this kind of problem

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326606620&siteId=291194637
Recommended