Skip to content

Commit fb604c2

Browse files
committed
Refine code
1 parent 7bdfe82 commit fb604c2

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/pyarmor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1586,8 +1586,8 @@ def main(argv):
15861586

15871587
if args.func.__name__[1:] not in ('register', 'download'):
15881588
pytransform_bootstrap(capsule=DEFAULT_CAPSULE, force=args.boot)
1589-
logging.info(_version_info(verbose=0))
15901589

1590+
logging.info(_version_info(verbose=0))
15911591
logging.info('Python %d.%d.%d', *sys.version_info[:3])
15921592
args.func(args)
15931593

src/utils.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -747,17 +747,17 @@ def make_project_command(platform, python, pyarmor, output):
747747

748748
def get_registration_code():
749749
try:
750-
code = pytransform.get_license_info()['CODE']
751-
except Exception:
752-
# Sometimes dynamic library _pytransform has not been loaded
753-
licfile = os.path.join(HOME_PATH, 'license.lic')
754-
with open(licfile, 'rb') as f:
755-
lictext = b64decode(f.read())
756-
i = lictext.find(b'pyarmor-vax-')
757-
if i > 0:
758-
code = lictext[i:i+18].encode()
750+
if pytransform._pytransform:
751+
code = pytransform.get_license_info()['CODE']
759752
else:
760-
code = None
753+
# Sometimes dynamic library _pytransform has not been loaded
754+
licfile = os.path.join(HOME_PATH, 'license.lic')
755+
with open(licfile, 'rb') as f:
756+
lictext = b64decode(f.read())
757+
i = lictext.find(b'pyarmor-vax-')
758+
code = lictext[i:i+18].encode() if i > 0 else None
759+
except Exception:
760+
code = None
761761
return code
762762

763763

0 commit comments

Comments
 (0)