Error starting IDLE subprocess

I have the code below in a file with a name code.py. I use IDLEto edit the file. When I click Run>Run Module, I get an error:

"The IDLE subprocess did not establish a connection. Or IDLE cannot start the personal firewall subprocess that blocks the connection.

I am using Windows 7 Ultimate 64bit, but I have the 32-bit version of Python 2.7 installed.

I was looking for a solution on this site, as well as others, but they all seem to recommend deleting what is called tkinter.py(I have no idea what it is) or disabling my firewalls (I’m no one turned on aside Microsoft Security Essentials, which is not a firewall .)

#Globals
#-------------------

x_pad = 476
y_pad = 444

import ImageGrab
import os
import time
import win32api, win32con

def screenGrab():
    box = (x_pad+1,y_pad+1,x_pad+641,y_pad+480)
    im = ImageGrab.grab(box)
    im.save(os.getcwd() + '\\full_snap__' + str(int(time.time())) +
'.png', 'PNG')

def main():
    pass

if __name__ == '__main__':
    main()

def leftClick():
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0)
    time.sleep(.1)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
    print 'Click.'          #completely optional. But nice for debugging purposes.

def leftDown():
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN,0,0)
    time.sleep(.1)
    print 'left Down'

def leftUp():
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP,0,0)
    time.sleep(.1)
    print 'left release'

def mousePos(cord):
    win32api.SetCursorPos((x_pad + cord[0], y_pad + cord[1])

def get_cords():
    x,y = win32api.GetCursorPos()
    x = x - x_pad
    y = y - y_pad
    print x,y
+4
4

, "python.exe" "tkinter.py" ) (.. Tk() tkinter.py ). , python.

+4

. , , , .py , "C:\Python33", , "". , .

+1

!!! , -.

, - . ( , ) "tkinter" ( , , ). , , pycache, , . python .

- ( , , ), . . , !

+1

. code.py , Canopy numpy.

I tried reinstalling python, but what solved the problem for me just renamed the file. I named my file myCode.py, it all started fine. Strange problem ...

0
source

Source: https://habr.com/ru/post/1545359/


All Articles