python-idle

Python IDLE, importing XLRD, error generated in debug mode: AttributeError: '_ModuleLock' object has no attribute 'name'

我只是一个虾纸丫 提交于 2021-02-11 14:06:26
问题 I'm a newbie to Python and this is the first time I've tried debug mode. I've read the answers to almost similar questions on stackoverflow but none of them seem to address this situation: When I run this code in debug mode (IDLE, Windows 10): import xlrd print('Hello World!') and set a break-point on print('Hello World") and try to step through the code, I get the following error lines: > **Traceback (most recent call last): File "D:/data/python/hello_world.py", line 4, in <module> > import

How to change default character encoding for Python IDLE?

荒凉一梦 提交于 2021-02-10 14:42:10
问题 I'm using Python 3.6 on Windows. When I run a script using the standard Windows shell ( cmd.exe ), the default text encoding for stdin/stdout is 'utf-8' as expected in Python 3.x: python -c "import sys; print(sys.stdout.encoding)" utf-8 However, the same command on the IDLE shell leads to a different result, which is clearly annoying, especially for beginner students using IDLE as a first step IDE >>> import sys; print(sys.stdout.encoding) cp1252 It happens that IDLE defines PseudoOutputFile

IPython - cycle through blocks in input history?

送分小仙女□ 提交于 2021-02-10 07:12:40
问题 Say I input the following: def foo(): print(2) Then later, when I want to edit my function, I press the Up arrow key to rewrite it, and that cycles through my inputs one line at a time (i.e. first it shows print(2) , then def foo(): ). Is there any way to make it cycle through blocks of code the way IDLE does it? 回答1: I have this problem with an earlier version of iPython on Linux (11 I think). New versions do not do this. I currently still use 11, and my solution was to just use the iPython

IPython - cycle through blocks in input history?

左心房为你撑大大i 提交于 2021-02-10 07:01:05
问题 Say I input the following: def foo(): print(2) Then later, when I want to edit my function, I press the Up arrow key to rewrite it, and that cycles through my inputs one line at a time (i.e. first it shows print(2) , then def foo(): ). Is there any way to make it cycle through blocks of code the way IDLE does it? 回答1: I have this problem with an earlier version of iPython on Linux (11 I think). New versions do not do this. I currently still use 11, and my solution was to just use the iPython

How to set python IDLE to use pythonpath variable in Ubuntu 10.04

谁说我不能喝 提交于 2021-02-08 05:47:44
问题 I have set a pythonpath variable in my ~/.bashrc and it works fine when using python interpreter from the command line and bpython, but IDLE is not recognizing it. How can I configure it to load the pythonpath variable? Thanks in advance 回答1: You can upgrade Ubuntu, because it works fine on my 10.10 machine with the idle-python2.7 package and PYTHONPATH set in my ~/.profile (which shouldn't matter because bash normally loads both) Or you can change sys.path in /usr/bin/idle* as per Setting

What happens in the CPU when there is no user code to run?

戏子无情 提交于 2021-02-05 05:50:09
问题 It sounds reasonable that the os/rtos would schedule an "Idle task". In that case, wouldn't it be power consuming? (it sounds reasonable that the idle task will execute: while (true) {} ) 回答1: This depends on the OS and the CPU architecture. On x86 (Intel compatible) the operating system might execute HLT instructions, making the CPU wait until something interesting happens, such as a hardware interrupt. This supposedly consumes very little power. Operating systems report the time spent doing

Is there a single python module for colored text output in idle, Powershell and terminal?

狂风中的少年 提交于 2021-01-29 20:59:37
问题 I need a python module that prints a colored output text for input() and print() functions which works on idle, Powershell, and Linux consols. I am just expecting few colors (no extra background features required) and the same functions should work equally on python idle, PowerShell, terminal, and cmd with full flexibility of code. 回答1: You can use 'clrprint' module which works for idle, terminal and PowerShell too pip install clrprint from clrprint import * clrhelp() # print's available

Is there a single python module for colored text output in idle, Powershell and terminal?

笑着哭i 提交于 2021-01-29 18:29:45
问题 I need a python module that prints a colored output text for input() and print() functions which works on idle, Powershell, and Linux consols. I am just expecting few colors (no extra background features required) and the same functions should work equally on python idle, PowerShell, terminal, and cmd with full flexibility of code. 来源: https://stackoverflow.com/questions/62933340/is-there-a-single-python-module-for-colored-text-output-in-idle-powershell-and

Debugger in Python freezes over own built modules

孤街醉人 提交于 2021-01-29 02:49:39
问题 I think this question is addressed here: Python spyder debug freezes with circular importing But I didn't quite get a solution. First time using the Debugger in Python. I am using IDLE. The program runs fine otherwise, but when run through the Debugger it freezes and I have to kill the program. The problem, I have figured out, is that I import scripts that I have created, that I use mostly as databases. So it's something like this. from ownScript import array where array is just a list of

Debugger in Python freezes over own built modules

别等时光非礼了梦想. 提交于 2021-01-29 02:44:42
问题 I think this question is addressed here: Python spyder debug freezes with circular importing But I didn't quite get a solution. First time using the Debugger in Python. I am using IDLE. The program runs fine otherwise, but when run through the Debugger it freezes and I have to kill the program. The problem, I have figured out, is that I import scripts that I have created, that I use mostly as databases. So it's something like this. from ownScript import array where array is just a list of