'test:TypeError: expected str, bytes or os.PathLike object, not None Type
I am trying to run this code in anaconda python3.7, but I'm getting below error:
TypeError: expected str, bytes or os.PathLike object, not NoneType
This is for windows 10, running on python 3.7
import os
import sys
import argparse
import numpy as np
import tensorflow as tf
sys.path.append(os.getcwd())
from model import get_model
from utils.visualize import plot
def sigmoid(x):
return 1.0 / (1.0 + np.exp(-x))
PARSER = argparse.ArgumentParser(description='CLI for inference')
PARSER.add_argument('--file', type=str, help='Image on which to perform inference')
PARSER.add_argument('--savedmodel', type=str, default='model/iter-51042',
help='SavedModel directory')
PARSER.add_argument('--k', type=int, default=5, help='Top K predictions to print')
PARSER.add_argument('--visualize', action='store_true', default=False, help='Whether to
visualize <file>')
PARSER.add_argument("-f", "--fff", help="a dummy argument to fool ipython", default="1")
ARGS = PARSER.parse_args()
FILE = ARGS.file
SAVED_MODEL = ARGS.savedmodel
K = ARGS.k
VISUALIZE = ARGS.visualize
pt_cloud = np.load(FILE)
pt_cloud = np.expand_dims(pt_cloud, axis=0)
So when I run python manage.py test trips.tests, I'm getting the this traceback error:
TypeError Traceback (most recent call last)
C:\Users\ADMINI~1\AppData\Local\Temp/ipykernel_22664/1093035628.py in <module>
31
32 # Load point cloud
---> 33 pt_cloud = np.load(FILE)
34 pt_cloud = np.expand_dims(pt_cloud, axis=0)
C:\ProgramData\Anaconda3\envs\Abdou_Env\lib\site-packages\numpy\lib\npyio.py in
load(file, mmap_mode, allow_pickle, fix_imports, encoding)
405 own_fid = False
406 else:
--> 407 fid = stack.enter_context(open(os_fspath(file), "rb"))
408 own_fid = True
409
TypeError: expected str, bytes or os.PathLike object, not NoneType
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
