Is this the right location to launch IDLE?

J

John Salerno

I'm trying to get Notepad++ to launch IDLE and run the currently open file in IDLE, but all my attempts have failed so far. I'm wondering, am I even using the IDLE path correctly? I'm using this:

"C:\Python32\Lib\idlelib\idle.pyw" "$(FULL_CURRENT_PATH)"

(That last part puts in the full path to the open file.)

Is this not the proper way to launch IDLE with an argument? It actually does open up IDLE, but the file doesn't seem to have been loaded, because when I try to use variables or functions from the file, IDLE acts as if it doesn't know what I'm referring to.

Thanks.
 
C

Chris Rebert

I'm trying to get Notepad++ to launch IDLE and run the currently open file in IDLE, but all my attempts have failed so far. I'm wondering, am I even using the IDLE path correctly? I'm using this:

"C:\Python32\Lib\idlelib\idle.pyw" "$(FULL_CURRENT_PATH)"

(That last part puts in the full path to the open file.)

Is this not the proper way to launch IDLE with an argument?

Correct. According to IDLE's USAGE message, you want the "-r" option,
which would make your desired command:
"C:\Python32\Lib\idlelib\idle.pyw" -r "$(FULL_CURRENT_PATH)"
It actually does open up IDLE, but the file doesn't seem to have been loaded, because when I try to use variables or functions from the file, IDLE acts as if it doesn't know what I'm referring to.

Cheers,
Chris
 
D

Dennis Lee Bieber

I'm trying to get Notepad++ to launch IDLE and run the currently open file in IDLE, but all my attempts have failed so far. I'm wondering, am I even using the IDLE path correctly? I'm using this:

"C:\Python32\Lib\idlelib\idle.pyw" "$(FULL_CURRENT_PATH)"

(That last part puts in the full path to the open file.)

Is this not the proper way to launch IDLE with an argument? It actually does open up IDLE, but the file doesn't seem to have been loaded, because when I try to use variables or functions from the file, IDLE acts as if it doesn't know what I'm referring to.
What happens if you specify

"C:\Python32\pythonw.exe" "C:\....\idle.pyw" "$...."

I seem to recall that Windows has problems passing command line
arguments when it goes through two layers of invocation (ie: your file
is an argument to idle.pyw, the file associations make idle.pyw an
argument to some other program instead.
 
J

John Salerno

Unfortunately neither method worked. Adding "-r" to the path created this error when I tried it:
*** Error in script or command!

Traceback (most recent call last):
File "C:\Users\John\Documents\Python Scripts\chess_pieces.py", line 1
class ChessPiece:
^
SyntaxError: invalid character in identifier
Although there really is no error in the file, and running it directly fromwithin IDLE doesn't cause this problem.

Adding the "pythonw.exe" part to the beginning also gave this error, but when I remove the "-r", then it just opens IDLE as normal, but without havingloaded the Notepad++ file.

I just know there has to be a way to do this, but perhaps it's more of an NP++ problem. I posted on their forums but no one responded. I thought I might see if the problem lies with calling IDLE, but apparently it's a Windows/NP++ thing...
 
C

Chris Rebert

Unfortunately neither method worked. Adding "-r" to the path created thiserror when I tried it:

*** Error in script or command!

Traceback (most recent call last):
 File "C:\Users\John\Documents\Python Scripts\chess_pieces.py", line1
   ï»¿class ChessPiece:

That would be a Notepad++ problem. That "" gibberish is what you
get when a Unicode BOM (Byte Order Mark) character is encoded as UTF-8
but decoded as ISO-8859-1 or CP-1252. A BOM is not recommended for
UTF-8 text; there should be some setting in Notepad++ to suppress it.

Cheers,
Chris
 
J

John Salerno

That would be a Notepad++ problem. That "" gibberish is what you
get when a Unicode BOM (Byte Order Mark) character is encoded as UTF-8
but decoded as ISO-8859-1 or CP-1252. A BOM is not recommended for
UTF-8 text; there should be some setting in Notepad++ to suppress it.

You are my new hero! :) It works perfectly now!

I set the default for files to be UTF-8 without BOM, and I also checked theoption that said "Apply to opened ANSI files." Is that okay?

Thank you!!!
 
J

John Salerno

That would be a Notepad++ problem. That "" gibberish is what you
get when a Unicode BOM (Byte Order Mark) character is encoded as UTF-8
but decoded as ISO-8859-1 or CP-1252. A BOM is not recommended for
UTF-8 text; there should be some setting in Notepad++ to suppress it.

You are my new hero! :) It works perfectly now!

I set the default for files to be UTF-8 without BOM, and I also checked theoption that said "Apply to opened ANSI files." Is that okay?

Thank you!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top