FAQ Database Discussion Community


VTK installation Python : Canopy

python,vtk,canopy
I have installed VTK on Canopy but when I try to run a VTK Python program, it throws me Error: import vtkpython ImportError: No module named 'vtkpython Can Someone tell me Why I am getting this error....

why canopy always import a wrong python file

python,import,canopy
I have two python script named main.py and track.py. I tried to import track.py in main.py in the way below: import track ... And I tried to call a function in track.py in main.py below a=track.localization() But when I change the code of track.py, I think it make no result....

IOError for savefig JPG in matplotlib

python,matplotlib,jpeg,canopy
I am trying to save a JPG and having issues. The following gives "IOError: encoder error -2 when writing image file" import matplotlib.pyplot as plt plt.plot([1, 2]) plt.savefig('image.jpg') It works with png so I tried to: pip install pillow as suggested here but it was already installed in Canopy. It...

Unable to run simple “if__name__ =='__main__':” syntax using Canopy [closed]

python,canopy
I obtained the following password generator (Test.py) from the Internet and I thought it would be easy to run in Canopy but it does not seem to work at all. I get invalid syntax errors all the time. I send the code to a colleague of mine and she said...

Python 2.7 : Entire code getting written in a file issue

python,file,python-2.7,canopy,writing
I've kind of a simple issue. In a program - the program doesn't matter -, only the first lines, i open an empty file (named empty.txt). Then i define functions, but never use them on main ... so, I do not actually write anything. This the nearly complete code: from...

Qt programs (Canopy GUI, ipython qtconsole) crash in Enthought Canopy Win7 64Bits

python,qt,pyside,enthought,canopy
I installed Canopy 1.5.2 on Windows 7 - 64 Bits. I performed all steps described on Enthought web page, but Canopy GUI won't to start. I realized that the problem is something related with Qt, because applications that don't need such programs (like Mayavi, Pylab, etc) work perfectly. When I...

pyside-rcc “dyld: Library not loaded:…”

osx,pyqt4,pyside,enthought,canopy
I'm a python and Qt rookie and I have some problems running pyside-rcc (and pyrcc4). The problem is not the link to the executable but a library problem it seems. That I'm not a unix wizard, probably doesn't help either:) When I run $ pyside-rcc i get the following error...

List of lists python 2.7

python,windows,python-2.7,canopy
I have the following Python 2.7 code: #-*- coding: latin1 -*- kw=int(input("Precio del Kw: ")) numeroCasas=int(input("Cantidad de Casas: ")) consumos={} consumo={} for i in range(numeroCasas): print("Casa numero " + str(i+1) + ": ") consumo["propietario"]=raw_input("\tNombre del Propietario: ") consumo["numCasa"]=raw_input("\tNumero de Casa: ") consumo["consumo"]=int(raw_input("\tConsumo: ")) consumos={i : consumo} print("\nCompletado. \nValor del Kw:...

Enthought Canopy python - name ' ' not defined

python,function,enthought,canopy
I'm very new to using canopy and programming in general. I'm trying to define a function in Python in the canopy editor. This used to work for me but has suddenly stopped and I have no idea why. As a basic example, in the editor I wrote; def funct(x): return...

What's the shortcut to interrupt the kernel in Canopy?

osx,kernel,interrupt,shortcut,canopy
I'm on OSX, using canopy. Does anybody know what the shortcut for interrupting the kernel is? Thanks.

Python tkinter button lagging/printing upon exit

python,user-interface,button,tkinter,canopy
First of all note that I am doing all these in Enthought/Canopy. I have this basic GUI where it has 4 entry boxes in which you type stuff, and then you hit a button and it prints the stuff you entered. However, it is not operating the way I want...

Python time stamp does not print - open large txt

python,time,canopy
Code below open and loops over a 500 MB txt file. It's running for almost half hour now and the funny thing is it did not print the first 'time.gmtime()'. I restarted the Kernel a couple of times to check for problems but all seems fine. Why didn't python print...

How we can draw two series of data in “openpyxl” package of python (line-chart)

python,canopy,openpyxl
Suppose that we have this code: from openpyxl import Workbook wb = Workbook() ws = wb.active for row in range(1,10): value = ws.cell(row=row,column=1).value = row+5 for row in range(1,10): value2 = ws.cell(row=row,column=2).value = row wb.save("SampleChart.xlsx") from openpyxl.charts import Reference, Series,LineChart values = Reference(ws, (1, 1), (9, 1)) series = Series(values,...

OLS Breusch Pagan test in Python

python,statistics,canopy,pysal
I used the statsmodels package to estimate my OLS regression. Now I want Breusch Pagan test. I used the pysal package for this test but this function returns an error: import statsmodels.api as sm import pysal model = sm.OLS(Y,X,missing = 'drop') rs = model.fit() pysal.spreg.diagnostics.breusch_pagan(rs) returned error: AttributeError: 'OLSResults' object...

Python keras neural network (Theano) package returns an error about data dimensions

python,numpy,canopy,theano,keras
I have this code: import numpy as np from keras.models import Sequential from keras.layers.core import Dense, Dropout, Activation from keras.optimizers import SGD from sklearn import datasets import theano iris = datasets.load_iris() X = iris.data[:,0:3] # we only take the first two features. Y = iris.target X = X.astype(theano.config.floatX) Y =...