spyder

spyder - clear variable explorer along with variables from memory

随声附和 提交于 2019-12-18 12:26:14
问题 To clear the console we can use the following command - import subprocess as sp tmp = sp.call('cls',shell=True) However, to remove a variable from memory, we often rely upon - using del command removing variable manually by using the drop-down menu in variable explorer But both of them are variable specific and hence time-consuming. So is there any general command (like clear under MATLAB) to remove a variable from memory and thereafter from Spyder's Variable Explorer. 回答1: In Spyder, Do

Spyder does not autocomplete local variables

混江龙づ霸主 提交于 2019-12-18 10:06:08
问题 I'm having a problem getting my local variables autocompleted. This is a very basic functionality which I'm sure it should support. When I'm starting to write a variable name which was already declared, and press TAB (this is the default shortcut), I get nothing. Is this a bug? 回答1: ( Spyder dev here ) Spyder does complete local variables but to have this functionality you need to install a library called rope . You can do it by running this command in a terminal pip install rope If you use

update module on import to python interpreter

 ̄綄美尐妖づ 提交于 2019-12-18 08:58:07
问题 In short How to force python interpreter to load the most up-to-date code version of my module everytime I make some changes in the module code? Or at least reload the last modified version by typing >>> from myModule import * into console, without necessity to restart whole python console and setup everything again and again anytime I make some changes? This is extremely unpleasant behavior for debugging. --------- LONGER STORY ----------- I tried to delete the .pyc file , and import it

How can I prevent Python from inserting a new line after taking user input?

跟風遠走 提交于 2019-12-18 08:49:32
问题 Python inserts a blank line in the console output between every call of the input() function but I don't want that (i.e. I want the input() prompts to be on contiguous lines in the console instead of separated by a blank line). Is there a way to do that? I tried using input("foo", end="") thinking it may work like the print() function but that's not the case... Code: fname = input("Please enter your first name: ") lname = input("Please enter your last name: ") print("Pleased to meet you, " +

PySide Qt script doesn't launch from Spyder but works from shell

醉酒当歌 提交于 2019-12-18 07:25:11
问题 I have a weird bug in my project that uses PySide for its Qt GUI, and in response I'm trying to test with simpler code that sets up the environment. Here is the code I am testing with: https://stackoverflow.com/a/6906552/130164 When I launch that from my shell ( python test.py ), it works perfectly. However, when I run that script in Spyder, I get the following error: Traceback (most recent call last): File "/home/test/Desktop/test/test.py", line 31, in <module> app = QtGui.QApplication(sys

PySide Qt script doesn't launch from Spyder but works from shell

江枫思渺然 提交于 2019-12-18 07:25:05
问题 I have a weird bug in my project that uses PySide for its Qt GUI, and in response I'm trying to test with simpler code that sets up the environment. Here is the code I am testing with: https://stackoverflow.com/a/6906552/130164 When I launch that from my shell ( python test.py ), it works perfectly. However, when I run that script in Spyder, I get the following error: Traceback (most recent call last): File "/home/test/Desktop/test/test.py", line 31, in <module> app = QtGui.QApplication(sys

Trying to fit a sine function to phased light curve

有些话、适合烂在心里 提交于 2019-12-18 07:24:28
问题 import numpy as np import matplotlib.pyplot as plt from lmfit import Model,Parameters f2= "KELT_N16_lc_006261_V01_west_tfa.dat" t2="TIMES" # file name NewData2 = np.loadtxt(t2, dtype=float, unpack=True) NewData = np.loadtxt(f2,dtype=float, unpack=True, usecols=(1,)) flux = NewData time= NewData2 new_flux=np.hstack([flux,flux]) # fold period = 2.0232 # period (must be known already!) foldTimes = ((time)/ period) # divide by period to convert to phase foldTimes = foldTimes % 1 # take fractional

AttributeError: module ‘xgboost’ has no attribute ‘XGBRegressor’

一笑奈何 提交于 2019-12-18 07:23:21
问题 I am trying to run xgboost using spyder and python, but I keep getting this error: AttributeError: module ‘xgboost’ has no attribute ‘XGBRegressor’ Here is the code: import xgboost as xgb xgb.XGBRegressor(max_depth=3, learning_rate=0.1, n_estimators=100, silent=True, objective='reg:linear', gamma=0, min_child_weight=1, max_delta_step=0, subsample=1, colsample_bytree=1, seed=0, missing=None) Error is Traceback (most recent call last): File "<ipython-input-33-d257a9a2a5d8>", line 1, in <module>

Spyder IDE Console History

匆匆过客 提交于 2019-12-18 05:56:37
问题 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. 回答1: 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. 回答2: 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

How do I debug efficiently with spyder in Python?

大憨熊 提交于 2019-12-17 21:42:52
问题 I like Python and I like Spyder but I find debugging with Spyder terrible! Every time I put a break point, I need to press two buttons: first the debug and then the continue button (it pauses at first line automatically) which is annoying. Moreover, rather than having the standard iPython console with auto completion etc I have a lousy ipdb>> console which is just garbage. The worst thing is that this console freezes very frequently even if I write prints or simple evaluation to try to figure