@@ -1838,24 +1838,33 @@ <h2 id="version-history">Version History</h2>
18381838 """Returns the rasterized image of the migrant"""
18391839 if self.image_file:
18401840 self._download_PNG() # download PNG if not cached
1841- return Image.open(self.image_file)
1841+ if os.path.isfile(self.image_file):
1842+ return Image.open(self.image_file)
1843+ else:
1844+ print(f"the expected file {self.image_file} does not exist")
18421845
18431846 # rawimage property
18441847 @property
18451848 def _rawimage(self):
18461849 """returns the raw (binary) image of the migrant"""
18471850 if self.image_file:
1848- with open(self.image_file, "rb") as f:
1849- image_bytes = f.read()
1850- return image_bytes
1851+ if os.path.isfile(self.image_file):
1852+ with open(self.image_file, "rb") as f:
1853+ image_bytes = f.read()
1854+ return image_bytes
1855+ else:
1856+ print(f"the expected file {self.image_file} does not exist")
18511857
18521858 # structure
18531859 @property
18541860 def structure(self):
18551861 """Returns the metadata associated with the migrant"""
18561862 if self.structure_file:
18571863 self._download_SDF() # download SDF if not cached
1858- return parse_sdf(self.structure_file)
1864+ if os.path.isfile(self.structure_file):
1865+ return parse_sdf(self.structure_file)
1866+ else:
1867+ print(f"the expected file {self.structure_file} does not exist")
18591868
18601869 # low-level model validator and property assignment
18611870 def _validate_and_set_model(self, prop, model, template, update_params,PropertyModel,PropertyModelValidator):
@@ -4604,24 +4613,33 @@ <h2 id="raises">Raises</h2>
46044613 """Returns the rasterized image of the migrant"""
46054614 if self.image_file:
46064615 self._download_PNG() # download PNG if not cached
4607- return Image.open(self.image_file)
4616+ if os.path.isfile(self.image_file):
4617+ return Image.open(self.image_file)
4618+ else:
4619+ print(f"the expected file {self.image_file} does not exist")
46084620
46094621 # rawimage property
46104622 @property
46114623 def _rawimage(self):
46124624 """returns the raw (binary) image of the migrant"""
46134625 if self.image_file:
4614- with open(self.image_file, "rb") as f:
4615- image_bytes = f.read()
4616- return image_bytes
4626+ if os.path.isfile(self.image_file):
4627+ with open(self.image_file, "rb") as f:
4628+ image_bytes = f.read()
4629+ return image_bytes
4630+ else:
4631+ print(f"the expected file {self.image_file} does not exist")
46174632
46184633 # structure
46194634 @property
46204635 def structure(self):
46214636 """Returns the metadata associated with the migrant"""
46224637 if self.structure_file:
46234638 self._download_SDF() # download SDF if not cached
4624- return parse_sdf(self.structure_file)
4639+ if os.path.isfile(self.structure_file):
4640+ return parse_sdf(self.structure_file)
4641+ else:
4642+ print(f"the expected file {self.structure_file} does not exist")
46254643
46264644 # low-level model validator and property assignment
46274645 def _validate_and_set_model(self, prop, model, template, update_params,PropertyModel,PropertyModelValidator):
@@ -5362,7 +5380,10 @@ <h2 id="returns">Returns</h2>
53625380 """Returns the rasterized image of the migrant"""
53635381 if self.image_file:
53645382 self._download_PNG() # download PNG if not cached
5365- return Image.open(self.image_file)</ code > </ pre >
5383+ if os.path.isfile(self.image_file):
5384+ return Image.open(self.image_file)
5385+ else:
5386+ print(f"the expected file {self.image_file} does not exist")</ code > </ pre >
53665387</ details >
53675388</ dd >
53685389< dt id ="loadpubchem.migrant.keval "> < code class ="name "> var < span class ="ident "> keval</ span > </ code > </ dt >
@@ -5637,7 +5658,10 @@ <h2 id="example">Example</h2>
56375658 """Returns the metadata associated with the migrant"""
56385659 if self.structure_file:
56395660 self._download_SDF() # download SDF if not cached
5640- return parse_sdf(self.structure_file)</ code > </ pre >
5661+ if os.path.isfile(self.structure_file):
5662+ return parse_sdf(self.structure_file)
5663+ else:
5664+ print(f"the expected file {self.structure_file} does not exist")</ code > </ pre >
56415665</ details >
56425666</ dd >
56435667< dt id ="loadpubchem.migrant.volumeDwelle "> < code class ="name "> var < span class ="ident "> volumeDwelle</ span > </ code > </ dt >
0 commit comments