plantcv-workshop
plantcv-workshop copied to clipboard
cannot import color_palette
import os
import sys
sys.path.append('/usr/local/lib/python3.6/site-packages')
sys.path.append('/Users/me/plantcv')
#sys.path.append('/Users/me/plantcv/plantcv/plantcv')
import numpy as np
import cv2
from matplotlib import pyplot as plt
%matplotlib inline
from plantcv import plantcv as pcv
from plantcv import color_palette
# Set variables
device = 0 # Workflow step counter
debug = 'plot' # Plot debug images to the notebook
img_file = './sample photos/IMG_6507.JPG' # Example image
I get the error: ImportError: cannot import name 'color_palette'
This is the path to the script: /Users/me/plantcv/plantcv/plantcv
Are my folders just set up weird?? Thanks!
@Mahi-Mai the notebook example is incorrect relative to the current version of PlantCV. The color_palette function was moved into the main repository. You could remove the color_palette import and change the line where the function is used to pcv.color_palette
.
Alternatively, if you want to keep as much the same as possible, you can change your line from plantcv import color_palette
to from plantcv.plantcv import color_palette
I'll have to tweak this script like the other one, but it looks like the color_palette isn't used in this notebook, so I don't need to call it. I took the line out, and the notebook ran fine.
Thanks!