spyder

How to save the output of an IPython console to a file in Spyder?

风流意气都作罢 提交于 2019-11-29 14:52:01
问题 I have a bug in my program :( The problem is that: My .py code is long, and takes ages to run I don't know where the bug is The good news is that I have a lot of print() in my py file, so I can potentially know where the bug lives. The bad news is that my bug makes my computer crash , so there is no way for me to look at the output of the ipython console and see what went wrong. How can I have the output be written to disk while the program runs? So that I can still open the file after reboot

Spyder IDE Console History

痞子三分冷 提交于 2019-11-29 10:50:29
How to see print history in console in spyder IDE ? If more data gets printed it does not shows on console and not even shows the scroll bar. The default configuration is to buffer 10,000 lines. If you require a larger buffer, you will have to change settings in Preferences -> Console -> Display -> Source Code -> Buffer: to increase the number of lines. This is an update for Spyder version 3.1.4: Tools Preferences (The shortcut is: Ctrl+Alt+Shift+P) IPython console (in the left menu of the Preferences utility) Source code Buffer: 500 Lines (in the right menu under the "Display" tab) Increase

Python Spyder initializing Hello World Kivi app once?

蓝咒 提交于 2019-11-29 10:40:04
Does anyone know why Python's 2.7 Spyder is successfully initializing the 'Hello World' Kivy app just once, i.e. hitting F5 brings the window app, but when I close it and hit F5 again, it says the following error: [INFO ] [Base ] Start application main loop [ERROR ] [Base ] No event listeners have been created [ERROR ] [Base ] Application will leave However, there is no error when initialized through Anacondas Command Prompt. Here's the code (same as website): from kivy.app import App from kivy.uix.button import Button class TestApp(App): def build(self): return Button(text='Hello World')

'import sitecustomize' failed upon starting spyder

被刻印的时光 ゝ 提交于 2019-11-29 07:37:24
I am trying to install python. Or actually, have installed and deinstalled it a few times now. I am using pythonxy with the spyder IDE (i am used to matlab is why i want to use spyder). The 3.3.2 python would not even start with spyder on my win8 machine, so now I have the 2.7 version installed. Spyder starts up now, but upon startup I get `'import sitecustomize' failed? in my console and python wont execute any commands I enter. After the error the startupscript keeps on going forever without doing anything and I cant do anything either anymore. The error tells me to start python with -v

How to ensure that Spyder runs within a conda environment?

十年热恋 提交于 2019-11-29 04:09:50
I created a conda environment called testenv in Windows 10 that contains Python 3.6 and Spyder. I also installed Selenium using the method described in this answer . I checked that these packages are installed with conda list -n testenv To run Spyder in that environment I followed the instructions in this answer and its related comments. So I activated the environment with activate testenv which modified the prompt to indicate that testenv is active. Then I typed spyder to launch Spyder. (When Spyder opens, my command window automatically closes, and if I open another one without closing

Set Spyder as default Python

家住魔仙堡 提交于 2019-11-29 03:53:50
I've recently installed Anaconda (using the default settings) on Windows 7. When I try to open a .py file by double-clicking it, I get the Open with... option. How can I set the default program as Spyder ? This is a variation based on Jose's solution of creating a .bat file that eventually worked for me. Create a spyder.bat file with the following content: start C:\YourPath\Anaconda2\pythonw.exe C:\YourPath\Anaconda2\cwp.py C:\YourPath\Anaconda2 "C:/YourPath/Anaconda2/pythonw.exe" "C:/YourPath/Anaconda2/Scripts/spyder-script.py" %1 Change YourPath to your actual Anaconda path. Other solutions

Why autocompletion options in Spyder 3.1 are not fully working in the Editor?

有些话、适合烂在心里 提交于 2019-11-29 02:13:19
Running on Mac Sierra, the autocompletion in Spyder (from Anaconda distribution), seems quite erratic. When used from the Ipython console, works as expected. However, when used from the editor (which is my main way of writing), is erratic. The autocompletion works (i.e. when pressing TAB a little box appears showing options) for some modules, such as pandas or matplotlib. So writing 'pd.' and hitting TAB, gets the box with options as expected. However, this does not happen with many other objects: for example, after defining a dataframe named 'df', typing 'df.' TAB shows nothing. In the

Interactive(?) plotting in Spyder with matplotlib

陌路散爱 提交于 2019-11-29 01:41:28
I am trying to migrate over to Python from Matlab and can't figure out how to get interactive(?) plotting working within the Spyder IDE. My test code is shown below. With the .ion() nothing happens, I get a quick flash of a figure being drawn then the window instantly closes and spits out my Hello. Without the .ion() the figure is drawn correctly but the script hangs and doesn't spit out Hello until I manually close the figure window. I would like the script to run like a matlab script would and plot the various figures I ask it to while chugging along any computations and putting the output

Spyder Python “object arrays are currently not supported”

て烟熏妆下的殇ゞ 提交于 2019-11-29 01:39:06
问题 I have a problem in Anaconda Spyder (Python). Object type array can not be seen under Windows 10 in the variable explorer . If I click on X or Y , I see an error: object arrays are currently not supported. I have Win 10 Home 64bit (i7-4710HQ) and Python 3.5.2 | Anaconda 4.2.0 (64-bit) [MSC v.1900 64 bit (AMD64)] 回答1: ( Spyder developer here ) Support for object arrays will be added in Spyder 4 , to be released in 2019. 回答2: A good example is here import numpy as np import pandas as pd import

独家 | 10个数据科学家常犯的编程错误(附解决方案)

不羁岁月 提交于 2019-11-29 00:25:16
简介: 本文为资深数据科学家常见的10个错误提供解决方案。 数据科学家是“比软件工程师更擅长统计学,比统计学家更擅长软件工程的人”。许多数据科学家都具有统计学背景,但是在软件工程方面的经验甚少。我是一名资深数据科学家,在Stackoverflow的python编程方面排名前1%,并与许多(初级)数据科学家共事。以下是我经常看到的10大常见错误,本文将为你相关解决方案: 不共享代码中引用的数据 对无法访问的路径进行硬编码 将代码与数据混合 在Git中和源码一起提交数据 编写函数而不是DAG 写for循环 不编写单元测试 不写代码说明文档 将数据保存为csv或pickle文件 使用jupyter notebook 1. 不共享代码中引用的数据 数据科学需要代码和数据。因此,为了让别人可以复现你的结果,他们需要能够访问到数据。道理很简单,但是很多人忘记分享他们代码中的数据。 import pandas as pd df1 = pd.read_csv('file-i-dont-have.csv') # fails do_stuff(df) 解决方案:使用d6tpipe( https://github.com/d6t/ d6tpipe)来共享你的代码中的数据文件、将其上传到S3/web/google驱动等,或者保存到数据库,以便于别人可以检索到文件(但是不要将其添加到git,原因见下文)。