<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Trying to run a .py file in IDLE from Notepad++]]></title><description><![CDATA[<p dir="auto">Hi guys, this is my first time on this board, and I’m not very experienced with programming yet, so this may be a dumb question.</p>
<p dir="auto">I’m following the lessons in “Automate the Boring Stuff with Python”, and I wanted to try to write my code in Notepad++ instead of IDLE’s built-in file editor. I tried following the advice on this page “<a href="https://silentcrash.com/2016/12/run-python-script-notepad/" rel="nofollow ugc">https://silentcrash.com/2016/12/run-python-script-notepad/</a>”, but every time I hit “Run” in Notepad, I get an error window titled “ShellExecute - ERROR” that states:</p>
<p dir="auto">"The system cannot find the file specified.<br />
An attempt was made to execute the below command.</p>
<hr />
<p dir="auto">Command:<br />
[location of <a href="http://idle.py" rel="nofollow ugc">idle.py</a>][location of file trying to be opened]<br />
Arguments:<br />
Error Code: 2"</p>
<p dir="auto">If you guys can help me out in any way I would be very appreciative, since Notepad++ looks like a very nice editor, and I would love to be able to open my little test programs into IDLE without any fuss.</p>
]]></description><link>https://community.notepad-plus-plus.org/topic/17553/trying-to-run-a-py-file-in-idle-from-notepad</link><generator>RSS for Node</generator><lastBuildDate>Wed, 17 Jun 2026 04:13:42 GMT</lastBuildDate><atom:link href="https://community.notepad-plus-plus.org/topic/17553.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 01 May 2019 20:32:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Trying to run a .py file in IDLE from Notepad++ on Mon, 06 May 2019 13:26:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/travis-vawser" aria-label="Profile: Travis-Vawser">@<bdi>Travis-Vawser</bdi></a> said:</p>
<blockquote>
<p dir="auto">Got rid of the pesky “H”, and now it works perfectly</p>
</blockquote>
<p dir="auto">Glad it works for you now.</p>
<p dir="auto">I tried to submit a comment to the <a href="https://silentcrash.com/2016/12/run-python-script-notepad/" rel="nofollow ugc">posted blog entry</a>, but it rejected my first two attempts as spam, and claimed to accept my third, though it hasn’t shown up yet.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/42928</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/42928</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Mon, 06 May 2019 13:26:40 GMT</pubDate></item><item><title><![CDATA[Reply to Trying to run a .py file in IDLE from Notepad++ on Mon, 06 May 2019 12:07:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/travis-vawser" aria-label="Profile: Travis-Vawser">@<bdi>Travis-Vawser</bdi></a> said:</p>
<blockquote>
<p dir="auto">my inexperience with coding is leaking through</p>
</blockquote>
<p dir="auto">Coding doesn’t have anything to do with it.  It is a lack of attention to detail (in other words, spelling things correctly).</p>
]]></description><link>https://community.notepad-plus-plus.org/post/42925</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/42925</guid><dc:creator><![CDATA[Alan Kilborn]]></dc:creator><pubDate>Mon, 06 May 2019 12:07:20 GMT</pubDate></item><item><title><![CDATA[Reply to Trying to run a .py file in IDLE from Notepad++ on Mon, 06 May 2019 05:04:54 GMT]]></title><description><![CDATA[<p dir="auto">…</p>
<p dir="auto">It would appear that my inexperience with coding is leaking through! Got rid of the pesky “H”, and now it works perfectly. Thank you so much for your help!</p>
]]></description><link>https://community.notepad-plus-plus.org/post/42923</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/42923</guid><dc:creator><![CDATA[Travis Vawser]]></dc:creator><pubDate>Mon, 06 May 2019 05:04:54 GMT</pubDate></item><item><title><![CDATA[Reply to Trying to run a .py file in IDLE from Notepad++ on Sat, 04 May 2019 22:38:41 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/travis-vawser" aria-label="Profile: Travis-Vawser">@<bdi>Travis-Vawser</bdi></a> said:</p>
<blockquote>
<p dir="auto">Instead, the IDLE window looked like this.</p>
</blockquote>
<p dir="auto"><img src="https://camo.nodebb.org/14eb3be14bfe48a0a17b34ead5a3191c6b7edac6?url=https%3A%2F%2Fi.imgur.com%2F3pZpiN3.png" alt="" class=" img-fluid img-markdown" /><br />
And if you look on the title bar of the IDLE window, you can see that it was trying to open <code>$(FULL_CURRENTH_PATH)</code>, not <code>$(FULL_CURRENT_PATH)</code>; since the extra <code>H</code> makes it a different (undefined) variable, Notepad++ didn’t translate it into the value of the actual <code>$(FULL_CURRENT_PATH)</code> variable.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/42916</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/42916</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Sat, 04 May 2019 22:38:41 GMT</pubDate></item><item><title><![CDATA[Reply to Trying to run a .py file in IDLE from Notepad++ on Sat, 04 May 2019 01:50:05 GMT]]></title><description><![CDATA[<p dir="auto">Thank you for responding! I noticed that you had spaces between “c:\path to\python#\Lib\idlelib\idle.py” and “$(FULL_CURRENT_PATH)”, which I previously did not have spaces between. After putting that space in, IDLE did end up opening, BUT it didn’t runt the program from Notepad++. Instead, the IDLE window looked like <a href="https://imgur.com/a/1hV5GY2" rel="nofollow ugc">this</a>.</p>
]]></description><link>https://community.notepad-plus-plus.org/post/42900</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/42900</guid><dc:creator><![CDATA[Travis Vawser]]></dc:creator><pubDate>Sat, 04 May 2019 01:50:05 GMT</pubDate></item><item><title><![CDATA[Reply to Trying to run a .py file in IDLE from Notepad++ on Wed, 01 May 2019 21:23:04 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/travis-vawser" aria-label="Profile: Travis-Vawser">@<bdi>Travis-Vawser</bdi></a>: welcome to the Notepad++ Community forum.</p>
<p dir="auto">You mentioned:</p>
<blockquote>
<p dir="auto">Python … “ShellExecute - ERROR”</p>
</blockquote>
<p dir="auto">Sounds like you’re following the same instructions as another user did last week: <a href="https://notepad-plus-plus.org/community/topic/17501/running-python" rel="nofollow ugc">asked here</a>.  We started giving advice, but the user dropped out of the conversation.  Hopefully, you’ll be able to stick around long enough to get your problem solved, rather than dropping out midway through.  Feel free to read through that advice first; it will help you understand where I am coming from.</p>
<p dir="auto">I do appreciate the link to the instructions you were following.  I see <s>two</s> three issues with <a href="https://silentcrash.com/2016/12/run-python-script-notepad/" rel="nofollow ugc">their advice</a>:</p>
<ol>
<li>They want you to specify a <code>.py</code> as the “executable” file.  That’s relying on the Windows <code>.py</code> association, and is where the “shell execute” message is coming from.  (That helps explain things, which the other poster had neglected to inform us about.)  Some run commands <em>will</em> work through their associations, but everything has to be set up “just so”.  I would actually recommend being more explicit, rather than relying on the default association, especially since it’s giving you trouble as-is.  More on this below.</li>
<li>Their python3 example command-line had spaces in the path to the “executable” (really, to the <code>idle.py</code> wrapper script), and following their directions for the python2 might also end up with spaces, depending on where your python2 installation really was.)  Any time a path does have (or may have) a space, you should really enclose it in quotes.</li>
<li>they show smartquotes rather than real quotes; if you copy/pasted those, that’s a likely culprit.</li>
</ol>
<p dir="auto">With that said, assume for the moment (python2 or python3) that your python executable is at <code>"c:\path to\python#\python#.exe"</code> and that your <code>idle.py</code> is at <code>"c:\path to\python#\Lib\idlelib\idle.py"</code>.<br />
If you want to follow their advice, and rely on the Windows <code>.py</code> association (and assuming that the association properly handles spaces in the python path; presumably it does if you’re able to run IDLE normally), then I would suggest:</p>
<pre><code>"c:\path to\python#\Lib\idlelib\idle.py" "$(FULL_CURRENT_PATH)"
</code></pre>
<p dir="auto">(note the real quotes; note that there are quotes around each path, because there are or may be spaces)</p>
<p dir="auto">If you want to get rid of the shell-execute interface (get rid of relying on the <code>.py</code> association),</p>
<pre><code>"c:\path to\python#\python#.exe" "c:\path to\python#\Lib\idlelib\idle.py" "$(FULL_CURRENT_PATH)"
</code></pre>
<p dir="auto">(I am not a command-line python expert, and the system that I’m on right now doesn’t have a python executable, so I’m not sure if python correctly cascades the remaining command-line arguments to your script.  I know that <code>perl.exe something.pl third.pl</code> will send <code>third.pl</code> as the argument to the <code>something.pl</code> script in the perl world… I would assume python.exe behaves similarly, so that FULL_CURRENT_PATH will be sent to the <a href="http://idle.py" rel="nofollow ugc">idle.py</a> script.)</p>
<p dir="auto">If those don’t work, please let us know exactly what paths you wrote.  (to avoid problems with smartquotes, surround any inline text with backticks (example: <code>`surrounded by backticks`</code> will render as <code>surrounded by backticks</code>), and use</p>
<pre><code>```
big long
text
```
</code></pre>
<p dir="auto">for inserting multiline blocks of code</p>
]]></description><link>https://community.notepad-plus-plus.org/post/42796</link><guid isPermaLink="true">https://community.notepad-plus-plus.org/post/42796</guid><dc:creator><![CDATA[PeterJones]]></dc:creator><pubDate>Wed, 01 May 2019 21:23:04 GMT</pubDate></item></channel></rss>