Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow for opening of files with corrupt create and/or modify dates. #55

Open
wants to merge 1 commit into
base: 2and3
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions gdsCAD/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2250,8 +2250,18 @@ def GdsImport(infile, rename={}, layers={}, datatypes={}, verbose=True, unit=1e-
if verbose==2:
print(data[0], end=' ')
elif 'BGNLIB' == rname:
kwargs['created'] = datetime.datetime(*data.tolist()[:6])
kwargs['modified'] = datetime.datetime(*data.tolist()[6:])
try:
kwargs['created'] = datetime.datetime(*data.tolist()[:6])
except:
warnings.warn("File created date may be corrupt. Resetting to right now.", stacklevel=2)
kwargs['created'] = datetime.datetime.today()

try:
kwargs['modified'] = datetime.datetime(*data.tolist()[6:])
except:
warnings.warn("File modify date may be corrupt. Resetting to right now.", stacklevel=2)
kwargs['modified'] = datetime.datetime.today()

if verbose==2:
print("created %d/%d/%d,%d:%d:%d modified %d/%d/%d,%d:%d:%d" % tuple(data.tolist()), end=' ')
elif 'LIBNAME' == rname:
Expand Down