Skip to content

Commit aa24928

Browse files
committed
Add to check if the bitstream exists
1 parent c4340ab commit aa24928

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pyfpga/project.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ def prog(self, bitstream=None, position=1):
245245
:param position: position of the device in the JTAG chain
246246
:type position: str, optional
247247
:raises ValueError: for missing or wrong values
248+
:raises FileNotFoundError: when bitstream is not found
248249
:raises RuntimeError: error running the needed underlying tool
249250
"""
250251
self.logger.debug('Executing prog')
@@ -255,6 +256,8 @@ def prog(self, bitstream=None, position=1):
255256
bitstream = f'{self.data["project"]}.{self.conf["prog_bit"]}'
256257
else:
257258
bitstream = Path(bitstream).resolve().as_posix()
259+
if not os.path.exists(bitstream):
260+
raise FileNotFoundError(bitstream)
258261
self.data['bitstream'] = bitstream
259262
self._prog_custom()
260263
self._create_file(f'{self.conf["tool"]}-prog', self.conf['prog_ext'])

0 commit comments

Comments
 (0)