python-idle

Python: Different results when using PyCharm and IDLE/python

那年仲夏 提交于 2019-12-01 15:51:01
I was just reading about the 'unexpected result of is operator' which happens because Python cache numbers between -5 and 256. This was discussed here: "is" operator behaves unexpectedly with integers and here: "is" and "id" in Python 3.5 When I run one of the examples given there, I get different results between Python Idle and Python IDE (I'm using Jetbrains Pycharm professional edition - 5.0.4). When using Python IDLE this is the result: a = 1000 b = 1000 print (a is b) # prints False when using Pycharm 5.0.4 this is the result: a = 1000 b = 1000 print (a is b) # prints True how could this

Python: Different results when using PyCharm and IDLE/python

China☆狼群 提交于 2019-12-01 15:40:26
问题 I was just reading about the 'unexpected result of is operator' which happens because Python cache numbers between -5 and 256. This was discussed here: "is" operator behaves unexpectedly with integers and here: "is" and "id" in Python 3.5 When I run one of the examples given there, I get different results between Python Idle and Python IDE (I'm using Jetbrains Pycharm professional edition - 5.0.4). When using Python IDLE this is the result: a = 1000 b = 1000 print (a is b) # prints False when

Python Enthought Canopy: multiprocessing not working

北城余情 提交于 2019-12-01 14:48:12
I've been trying multiprocessing with enthought canopy (Windows 8). I tried the following example: import multiprocessing nProcesses=3 def worker(): """worker function""" print "working" return if __name__ == '__main__': jobs = [] for i in range(nProcesses): p = multiprocessing.Process(target=worker) jobs.append(p) p.start() close to a copypaste of examples you find online... The processes are created but seem to do nothing. No printing of "working". I run my file (main.py) from the environment provided by Canopy (IDLE I think) but I do not copy those lines in the interpreter, I run the whole

Python Enthought Canopy: multiprocessing not working

ε祈祈猫儿з 提交于 2019-12-01 13:29:28
问题 I've been trying multiprocessing with enthought canopy (Windows 8). I tried the following example: import multiprocessing nProcesses=3 def worker(): """worker function""" print "working" return if __name__ == '__main__': jobs = [] for i in range(nProcesses): p = multiprocessing.Process(target=worker) jobs.append(p) p.start() close to a copypaste of examples you find online... The processes are created but seem to do nothing. No printing of "working". I run my file (main.py) from the

what is the difference between cmd and idle when using tqdm?

为君一笑 提交于 2019-12-01 12:13:12
recently I want to add a simple progress bar to my script, I use tqdm to that, but what puzzle me is that the output is different when I am in the IDLE or in the cmd for example this from tqdm import tqdm import time def test(): for i in tqdm( range(100) ): time.sleep(0.1) give the expected output in the cmd 30%|███ | 30/100 [00:03<00:07, 9.14it/s] but in the IDLE the output is like this 0%| | 0/100 [00:00<?, ?it/s] 1%|1 | 1/100 [00:00<00:10, 9.14it/s] 2%|2 | 2/100 [00:00<00:11, 8.77it/s] 3%|3 | 3/100 [00:00<00:11, 8.52it/s] 4%|4 | 4/100 [00:00<00:11, 8.36it/s] 5%|5 | 5/100 [00:00<00:11, 8

python multiprocess fails to start

泪湿孤枕 提交于 2019-12-01 10:31:27
问题 Here is my code for a simple multiprocessing task in python from multiprocessing import Process def myfunc(num): tmp = num * num print 'squared O/P will be ', tmp return(tmp) a = [ i**3 for i in range(5)] ## just defining a list task = [Process(target = myfunc, args = (i,)) for i in a] ## creating processes for each in task : each.start() # starting processes <------ problem line for each in task : each.join() # waiting all to finish up When I run this code, it hangs at certain point, so to

Controlling Paraview GUI from Python IDLE

旧城冷巷雨未停 提交于 2019-12-01 09:28:46
I am trying to control Paraview interactively using IDLE. This would involve sending commands from IDLE and seeing the changes occur in Paraview. I would rather not use the in-Paraview python shell. So far, I have succeeded in importing the Paraview modules (simple, servermanager…etc) from IDLE. However the commands sent do not reflect in Paraview. For instance: >>> from paraview.simple import * >>> cone = Cone() >>> Show() >>> Render() does indeed create a cone. However the cone is output to a new, independent OpenGL window, and not the Paraview GUI. Is it possible to control Paraview

Python IDLE freezes

自闭症网瘾萝莉.ら 提交于 2019-12-01 08:50:32
This is absolutely frustrating, but I am not sure if the following is an issue only on my machine or with IDLE in general. When attempting to print a long list in the shell, and that could happen by accident while debugging, the program crushes and you have to restart it manually. Even worse, if you have a few editor windows open, it always spawns a few sub-processes, and each of these has to be manually shut down from the task manager. Is there any way to avoid that? I am using Python 3, by the way. The Squeezer extension addresses this problem. Instead of displaying the long text (which is

How to save custom preferences of python's IDLE?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 08:20:00
I have several computers at different locations, and although I'm not coding in IDLE, it is always running in the background, for small testing, debugging and researching tasks. I configured IDLE custom highlighting, key set, etc. at home, and it would be pretty comfy to save my settings into an external file, and install these settings onto any machines I'm working on. So my question: is there a way to do that? Or it would be also nice, if anyone knows where IDLE stores these datas — probably I can copy the file(s) from there.. Thanks in advance! IDLE saves its preferences in several files in

How to save custom preferences of python's IDLE?

亡梦爱人 提交于 2019-12-01 07:49:02
问题 I have several computers at different locations, and although I'm not coding in IDLE, it is always running in the background, for small testing, debugging and researching tasks. I configured IDLE custom highlighting, key set, etc. at home, and it would be pretty comfy to save my settings into an external file, and install these settings onto any machines I'm working on. So my question: is there a way to do that? Or it would be also nice, if anyone knows where IDLE stores these datas —