Python IDLE crash on start - python

I can run idle3 from terminal and open a file from it perfectly.
However, if i try to open a .py file directly with it (via "Open with), it crashes immediately with the following log: https://pastebin.com/raw/c2jrNxh9
Python was installed with brew install python3 --with-tcl-tk and I have tried reinstalling it and restarting OS with no results.
Any idea what could be wrong with it?

Related

Pipenv run does not execute py file. Error reading broker pipe. VScode

I am trying to run the following simple python script called 'main.py', through a pipenv virtualenv:
print("started.")
Executing pipenv run ./main.py --verbose (in pipenv venv) does not print anything to the console.
Through VS code, running pipenv run ./main.py --verbose outputs the following:
That is to say, the python file seemingly does not run, expected 'started.' to be printed to the console, recieved nothing printed and program terminating.
This behaviour is also present when I attempt to run it through cmd, note the error produced with the --verbose flag:
I can run it sucessfully through just using python, however I really want to use pipenv to manage packages ect. I guess I'm mostly just curious at to:
Why does this error occur?
What does the following error, caused by running it with --verbose flag, mean?
[5772:0107/202720.999:ERROR:broker_win.cc(56)] Error reading broker pipe: The pipe has been ended. (0x6D)
How do I fix the issue?
I have reinstalled Pyhton, pipenv, and vscode - but have recieved the same results. Running the 'pipenv run' command both within the shell and outside the shell have the same results.
EDIT:
A Visual Studio Code issue
In the post above, after runing pipenv run main.py, vscode would always open. Whats stranger is, once vscode is uninstalled, the command works as expected! So an additional question of mine is,
Why does vscode make this issue happen/what's the fix for being able to code using vscode and running pipenv run?
see bellow for what occurs when running pipenv run main.py with vscode initally closed:
This screenshot is after ~5mins of no action in iether the vscode console or the cmd console. The program never exited, and closeing the cmd also closed vscode.
pipenv run main.py means open the file in the ide you chose in the pipenv environment.
In this way, it just opened the file instead of run python file.
You need to use command python main.py to run it.

Every time I open or switch to IDLE it spams Q

I'm on Windows, using WLS Ubuntu on terminal. Got python3 installed. Installed idle through
sudo apt-get install idle3
Every time I open IDLE through typing 'idle' in the terminal, or alt tab to IDLE, or run a .py file through IDLE, it starts spamming the letter Q. I wasn't able to reproduce this issue in any other program.
I tried reinstalling IDLE, to no avail.
Is there a fix for this? I want to keep using IDLE but this is driving me mad!

Pyautogui works in IDLE but not when i execute it as .py

the code is:
import pyautogui
pyautogui.moveTo(502, 632)
input()
it works in IDLE but when i save and run it, the screen flashes and closes. I tried reading it and it said error in line 1. Please Help.
Please check
Your python versions in both places you are running,
Whether pyautogui is installed in the env where you are running as .py file
It is running fine in place as .py file
I guess your interpreter doesn't have pyautogui.
just before run try this: pip install pyautogui this required install once.
I found the solution,
the thing is i had Anaconda distribution of python installed.
Idle was installed in normal python while the when i executed it as .py, anaconda was running it. I just uninstalled anaconda.

IDLE3 installed for Python however I can't open it

My linux distribution(Opensuse 42.2) comes with python 2.7 already installed, however I installed python3 on top of that. And in order to launch IDLE to run the python3 shell, I was told to install "python3-tools" and then just run "idle3" in terminal to launch the shell. However running "idle3" in terminal only brings up an error message, and I can't find any other suggestions. Any help would be extremely appreciated.
** I have fixed the problem. The sources that I found gave me the improper package name. After searching the main-repository for Opensuse, the proper package name for python3 IDLE was "python3-idle".

Running Python script from Ubuntu terminal NameError

I have recently moved from Python on Windows to Python on Ubuntu. In Windows I could just hit F5 in the IDLE editor to run the script. However, in Ubuntu I have to run the script by typing python /path/to/file.py to execute.
The thing is it seems the imports within the file are not working when I run from command line.
It gives me the error:
NameError: global name 'open_file' is not defined
This is the open_file method of Pytables. In the python file I have:
from tables import *
I have made the file executable and all.
Appreciate your help.
The pytables on my ubuntu system is 2.3.1. I think that open_file is a version 3 thing. I'm not sure where you can pick up the latest package, but you could always install the latest with pip.

Categories