Hi,
PhotoScan Pro Ver 1.2.6 Build 2834
I have the following code that returns an error, can someone tell me why?
This is the error I get (in red);
2017-09-14 09:27:38 Saving project...
2017-09-14 09:27:38 saved project in 0.016 sec
2017-09-14 09:27:38 Finished processing in 0.016 sec (exit code 1)
2017-09-14 09:27:38 Loading project...
2017-09-14 09:27:38 loaded project in 0 sec
2017-09-14 09:27:39 Finished processing in 0 sec (exit code 1)
2017-09-14 09:27:39 E:\python_dev\py_test101.psz
2017-09-14 09:27:39 ['E:\\python_dev\\JPEG\\DJI_0416.JPG', 'E:\\python_dev\\JPEG\\DJI_0417.JPG', 'E:\\python_dev\\JPEG\\DJI_0418.JPG', 'E:\\python_dev\\JPEG\\DJI_0419.JPG', 'E:\\python_dev\\JPEG\\DJI_0420.JPG', 'E:\\python_dev\\JPEG\\DJI_0421.JPG', 'E:\\python_dev\\JPEG\\DJI_0422.JPG', 'E:\\python_dev\\JPEG\\DJI_0433.JPG', 'E:\\python_dev\\JPEG\\DJI_0434.JPG', 'E:\\python_dev\\JPEG\\DJI_0435.JPG', 'E:\\python_dev\\JPEG\\DJI_0436.JPG', 'E:\\python_dev\\JPEG\\DJI_0437.JPG', 'E:\\python_dev\\JPEG\\DJI_0438.JPG', 'E:\\python_dev\\JPEG\\DJI_0439.JPG', 'E:\\python_dev\\JPEG\\DJI_0446.JPG', 'E:\\python_dev\\JPEG\\DJI_0447.JPG', 'E:\\python_dev\\JPEG\\DJI_0448.JPG', 'E:\\python_dev\\JPEG\\DJI_0449.JPG', 'E:\\python_dev\\JPEG\\DJI_0450.JPG', 'E:\\python_dev\\JPEG\\DJI_0451.JPG', 'E:\\python_dev\\JPEG\\DJI_0452.JPG', 'E:\\python_dev\\JPEG\\DJI_0462.JPG', 'E:\\python_dev\\JPEG\\DJI_0463.JPG', 'E:\\python_dev\\JPEG\\DJI_0464.JPG', 'E:\\python_dev\\JPEG\\DJI_0465.JPG', 'E:\\python_dev\\JPEG\\DJI_0466.JPG', 'E:\\python_dev\\JPEG\\DJI_0467.JPG']
2017-09-14 09:27:39 Traceback (most recent call last):
2017-09-14 09:27:39 File "E:/python_dev/create_project_ver2.py", line 28, in <module>
2017-09-14 09:27:39 chunk.addPhotos(image_list)
2017-09-14 09:27:39 AttributeError: 'NoneType' object has no attribute 'addPhotos'
>>>
This is the code;
import PhotoScan
import os
global doc
doc = PhotoScan.app.document
project_path = r'E:\python_dev\py_test101.psz'
path_photos = r'E:\python_dev\JPEG'
# Create project file
doc.save(project_path, chunks = doc.chunks)
doc.open(project_path)
chunk = doc.chunk
# Add Photos
image_list = [
os.path.join(path_photos, path)
for path in os.listdir(path_photos)
if path.lower().endswith(("jpg", "jpeg", "tif", "png"))
]
print(project_path)
print(image_list)
chunk.addPhotos(image_list)
# Save project
doc.save()
Ben