Skip to content

Commit

Permalink
Improved code
Browse files Browse the repository at this point in the history
  • Loading branch information
newwingbird committed Nov 17, 2024
1 parent 0838f71 commit e87b4dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions comtypes/client/_code_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,20 @@ def _find_gen_dir():
pymaj, pymin = sys.version_info[:2]
if ftype == None:
# Python script
subdir = f"Python\\Python{pymaj:d}{pymin:d}\\comtypes_cache"
subdir = rf"Python\\Python{pymaj:d}{pymin:d}\\comtypes_cache"
basedir = _get_appdata_dir()

elif ftype == "dll":
# dll created with py2exe
path = _get_module_filename(sys.frozendllhandle)
base = os.path.splitext(os.path.basename(path))[0]
subdir = f"comtypes_cache\\{base}-{pymaj:d}{pymin:d}"
subdir = rf"comtypes_cache\\{base}-{pymaj:d}{pymin:d}"
basedir = tempfile.gettempdir()

else: # ftype in ('windows_exe', 'console_exe')
# exe created by py2exe
base = os.path.splitext(os.path.basename(sys.executable))[0]
subdir = f"comtypes_cache\\{base}-{pymaj:d}{pymin:d}"
subdir = rf"comtypes_cache\\{base}-{pymaj:d}{pymin:d}"
basedir = tempfile.gettempdir()

gen_dir = os.path.join(basedir, subdir)
Expand Down
2 changes: 1 addition & 1 deletion comtypes/server/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def _registry_entries(self, cls):
f"{exe} {script}",
)
else:
append(HKCR, "CLSID\\%s\\LocalServer32" % reg_clsid, "", f"{exe}")
append(HKCR, "CLSID\\%s\\LocalServer32" % reg_clsid, "", "%s" % exe)

# Register InprocServer32 only when run from script or from
# py2exe dll server, not from py2exe exe server.
Expand Down

0 comments on commit e87b4dc

Please sign in to comment.