Re: [Tutor] Regarding "IDLE Subprocess Didn't Make Connection" Error

2018-11-18 Thread Mats Wichmann
On 11/17/18 10:38 AM, Avi Gross wrote:
> I was wondering if I was the only one who felt the urge to apply a tad of 
> humor and suppressed most of the thoughts about idol/IDLE worship and other 
> puns so I am glad to see Steve do just a little of the same.
> 
> It seems that despite how portable Python is touted to be, quite a few people 
> report problems in getting the basics working when installing. And if you 
> can't get started, that is obviously a barrier. My suggestion earlier was 
> based on the fact that IDLE is an add-on and they should first check if 
> Python itself works. Any text editor can be used that just produces plain 
> text and scripts can be run in other ways.
> 
> But I have a thought. An old an often effective method to solve a problem is 
> to search in the source code. Yes, you did not write IDLE. 
> 
>  I am still not clear on how IDLE aborts on startup but I recall that IDLE 
> may be written in Python with source code available. 

actually, one of the "surprising" ways IDLE can fail for people is
specifically because it is written in Python itself: if they have a
Python file in the directory they are starting it from that duplicates
the name of an important file in IDLE - if the import statement is
encountered in IDLE and that import can be satisfied by the local file
it picks that one first, and then IDLE breaks...

anyway, one of the common things people say to get around this is to
just dump IDLE.  this sounds harsh: Python strives to supply a usable
beginner environment and then it doesn't work, and we say "so don't use
it"?  well, it doesn't bother me to say that... there are tons of
IDE-type environments for Python, ones that call themselves editors but
have "run script inside the editor" behavior and ones that are full IDE.
By all means, try the information on the internet on getting IDLE
working, but it's not worth spending a *ton* of time on it, IDLE is not
Python, it's just a helpful tool, and if a tool doesn't work but another
one will, throw away the broken one.

Here are some thoughts:

https://wiki.python.org/moin/PythonEditors
https://wiki.python.org/moin/IntegratedDevelopmentEnvironments

those are user-edited pages, if anyone has more favorites that are not
listed there, please feel free to volunteer to add more.

Between several systems I have the following things that let me edit and
run Python code:

IDLE (yup, works for me)
Eric
Atom (with additional Python configuration for nicer env)
Eclipse (with Python environment pydev)
PyCharm (with additional Python configuration for nicer env)
SublimeText (with additional Python configuration for nicer env)
Visual Studio Code (with additional Python configuration for nicer env)
vim

some often favored Windows tools don't appear on this list, like
Code::Blocks, because I'm not principally a Windows user.

I don't use all of those: some not at all, some frequently, some
occasionally.  They all work fine.  All are free except SublimeText;
PyCharm comes in both free community and non-free other editions. Some
are big and heavy (I don't recommend Eclipse for the faint of heart),
some are not.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Regarding "IDLE Subprocess Didn't Make Connection" Error

2018-11-17 Thread Avi Gross
I was wondering if I was the only one who felt the urge to apply a tad of humor 
and suppressed most of the thoughts about idol/IDLE worship and other puns so I 
am glad to see Steve do just a little of the same.

It seems that despite how portable Python is touted to be, quite a few people 
report problems in getting the basics working when installing. And if you can't 
get started, that is obviously a barrier. My suggestion earlier was based on 
the fact that IDLE is an add-on and they should first check if Python itself 
works. Any text editor can be used that just produces plain text and scripts 
can be run in other ways.

But I have a thought. An old an often effective method to solve a problem is to 
search in the source code. Yes, you did not write IDLE. 

 I am still not clear on how IDLE aborts on startup but I recall that IDLE may 
be written in Python with source code available. I went into python to see 
where to look by seeing the path it would search.

>>> import sys
>>> print(sys.path)

I then followed a trail and what I found was idlelib with many components and 
when I import that library in the IDLE main unit I see some of the results:

>>> import idlelib
>>> dir(idlelib)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', 
'__package__', '__path__', '__spec__', 'autocomplete', 'autocomplete_w', 
'calltip_w', 'calltips', 'config', 'debugger', 'debugger_r', 'debugobj', 
'debugobj_r', 'hyperparser', 'iomenu', 'macosx', 'multicall', 'pyparse', 'rpc', 
'run', 'scrolledlist', 'stackviewer', 'testing', 'tree', 'windows', 
'zoomheight']

I could potentially follow along, and for a while I did. I think that after a 
few steps, on my machine, it hits pyshell in 
C:\Users\avid2016\AppData\Local\Programs\Python\Python37-32\Lib\idlelib and 
then runs code starting with:

#! /usr/bin/env python3

import sys

try:
from tkinter import *
except ImportError:
print("** IDLE can't import Tkinter.\n"
  "Your Python may not be configured for Tk. **", file=sys.__stderr__)
raise SystemExit(1)

And it goes on and on. It imports all kinds of things and creates many classes 
and if called directly, runs a big function called main. I searched for 
"subprocess" and "IDLE" to see if the file had whatever error message you saw 
and I think I found it in the definition of a function:

def display_no_subprocess_error(self):
tkMessageBox.showerror(
"Subprocess Startup Error",
"IDLE's subprocess didn't make connection.  Either IDLE can't "
"start a subprocess or personal firewall software is blocking "
"the connection.",
parent=self.tkconsole.text)

Correction, the first argument of "self' was a hint and that is actually a 
method in: 
class ModifiedInterpreter(InteractiveInterpreter):

Now if that is the error message, you work backwards to see when it might have 
been called/triggered.

Searching for a call to that method shows two places:

Here is one snippet:

self.spawn_subprocess()
#time.sleep(20) # test to simulate GUI not accepting connection
# Accept the connection from the Python execution server
self.rpcclt.listening_sock.settimeout(10)
try:
self.rpcclt.accept()
except socket.timeout:
self.display_no_subprocess_error()
return None

Here is the other:

self.spawn_subprocess()
try:
self.rpcclt.accept()
except socket.timeout:
self.display_no_subprocess_error()
return None

I am going to stop now and suggest it happens when IDLE creates a subprocess to 
run in parallel and plays games with sockets and fails.


FWIW, the method called before is:

def spawn_subprocess(self):
if self.subprocess_arglist is None:
self.subprocess_arglist = self.build_subprocess_arglist()
self.rpcsubproc = subprocess.Popen(self.subprocess_arglist)

Presumably something goes wrong in there but I suspect the Popen failed.

Why would it fail? Well, it could be many things including whatever actual info 
is in the arglist ...

That might take plenty of additional digging including suggestions about 
something not being set right in the path or other registry components or some 
rogue library component being imported rather than the intended one or so much 
more. But, in theory, you can even take the source code and run it more 
carefully and debug this. Not something for a novice.

Not sure if that helps but if I actually had to read all that code and do 
serious debugging, it might take me days and I have a funeral and a party 
(unrelated) to go to today alone 


-Original Message-
From: Tutor  On Behalf Of Steven 
D'Aprano
Sent: Saturday, November 17, 2018 6:18 AM
To: tutor@python.org
Subject: Re: [Tutor] Regarding "IDLE Subproc

Re: [Tutor] Regarding "IDLE Subprocess Didn't Make Connection" Error

2018-11-17 Thread Steven D'Aprano
Another thought comes to mind...

On Thu, Nov 15, 2018 at 03:38:28PM -0800, Break fast wrote:

> "IDLE subprocess didn't make connection. Either IDLE can't start a
> subprocess, or personal Firewall software is blocking the connection"
> 
> I have been researching this issue nonstop the last two days, and haven't
> had any luck in resolving the issue.
> 
> 
> I am running Windows 7 (x64), and have installed Python 3.7.1 and 3.6.7
> numerous times now.

Try opening a Windows console (command prompt) and launching IDLE from 
that, just in case some more informative error messages are printed to 
the console. You can try these commands:

python36 -m idlelib

python37 -m idlelib


and if they print any error messages, please copy the ENTIRE 
message and send them to this list.



-- 
Steve
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Regarding "IDLE Subprocess Didn't Make Connection" Error

2018-11-17 Thread Steven D'Aprano
On Thu, Nov 15, 2018 at 03:38:28PM -0800, Break fast wrote:

> "IDLE subprocess didn't make connection. Either IDLE can't start a
> subprocess, or personal Firewall software is blocking the connection"
> 
> I have been researching this issue nonstop the last two days,

Without pausing to eat or sleep? You're more dedicated than I would 
be...


> and haven't had any luck in resolving the issue.

This is a common issue, there's probably a bazillion places that talk 
about it:

https://duckduckgo.com/?q=IDLE+subprocess+didn%27t+make+connection

Unfortunately there are many different things which could cause it (the 
error message is, frankly, unhelpful). This bug report looks promising:

https://bugs.python.org/issue14576

Try making sure that the HOME environment variable exists, and is 
writable.

 
> I am running Windows 7 (x64), and have installed Python 3.7.1 and 3.6.7
> numerous times now.

Why? Reinstalling should be the *last* resort, not first, and especially 
not reinstalling over and over and over again.



-- 
Steve
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Regarding "IDLE Subprocess Didn't Make Connection" Error

2018-11-16 Thread Avi Gross

BREAK fast ,

You certainly haven't been idle!

Until you get IDLE working ideally, you can still use one of many text editors 
and programming environments and perhaps run python on the files manually. 

Have you verified that the rest of your installation worked?


Sent from AOL Mobile Mail
On Friday, November 16, 2018 Break fast  wrote:
Hello Python Tutors,

First off, thank you for existing! I hope I am emailing the right queue in
this situation.

I have installed Python from the python.org website, but have found myself
unable to use IDLE due to an error that is as follows:

"IDLE subprocess didn't make connection. Either IDLE can't start a
subprocess, or personal Firewall software is blocking the connection"

I have been researching this issue nonstop the last two days, and haven't
had any luck in resolving the issue.


I am running Windows 7 (x64), and have installed Python 3.7.1 and 3.6.7
numerous times now.

>I have shut off Avast (the only firewall on this pc).
>Scoured the Python root folder for any .py files, and there are none.
>Restarted PC after each install.
>Installed Python to a different harddrive.
>Ran IDLE as Admin

And I am still encountering the same issue.

If anybody has any insight on how to proceed from here, I would be
extremely grateful for any advice you could offer.

Thank you again, and hope you all have a good day!

--Logan McDonald


Virus-free.
www.avast.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Regarding "IDLE Subprocess Didn't Make Connection" Error

2018-11-16 Thread Break fast
Hello Python Tutors,

First off, thank you for existing! I hope I am emailing the right queue in
this situation.

I have installed Python from the python.org website, but have found myself
unable to use IDLE due to an error that is as follows:

"IDLE subprocess didn't make connection. Either IDLE can't start a
subprocess, or personal Firewall software is blocking the connection"

I have been researching this issue nonstop the last two days, and haven't
had any luck in resolving the issue.


I am running Windows 7 (x64), and have installed Python 3.7.1 and 3.6.7
numerous times now.

>I have shut off Avast (the only firewall on this pc).
>Scoured the Python root folder for any .py files, and there are none.
>Restarted PC after each install.
>Installed Python to a different harddrive.
>Ran IDLE as Admin

And I am still encountering the same issue.

If anybody has any insight on how to proceed from here, I would be
extremely grateful for any advice you could offer.

Thank you again, and hope you all have a good day!

--Logan McDonald


Virus-free.
www.avast.com

<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor