-
Notifications
You must be signed in to change notification settings - Fork 44
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
File types not associated when using file_extensions on Windows #185
Comments
Note: this does not appear to establish file type association (conda/menuinst#185)
Hm, can you try with a leading period for the extensions? See example. "It works on CI", but CI runs as administrator by default, so we might need to adjust something. "Open With" has not been added per se, as it requires some extra registry keys. |
@mrclary did you have a chance to take a look at the workaround? |
@jaimergp, sorry, I have not yet had a chance to look at it. |
The short of itI suspect that an error occurs on install after the first item in the file extension list is handled resulting in no other extensions being handled, but the shortcut is produced. On uninstall, an error results due to the missing expected AssocFiles. The long of itSo I tried using
This version of Spyder does not have file extensions listed in the
However, I get the following errors after modifying spyder-menu.json
And attempting to uninstall:
If I only have one extension in the list, the install produces the same error, although the AssocFile is produced. The uninstall does not produce an error. So, I suspect that the error occurs on install after the first extension in the list is handled resulting in no other extensions being handled, but the shortcut is produced nonetheless. Then, on uninstall, the error is a result of the missing expected AssocFiles. |
Looks like the problem is at: menuinst/menuinst/platforms/win_utils/registry.py Lines 73 to 76 in db52885
So maybe it works if you remove the |
Note: this does not appear to establish file type association (conda/menuinst#185)
Note: this does not appear to establish file type association (conda/menuinst#185)
Note: this does not appear to establish file type association (conda/menuinst#185)
Note: this does not appear to establish file type association (conda/menuinst#185)
@jaimergp, with The only issue that remains is that the file type association in context menus appears as Python instead of Spyder (both name and icon). Nevertheless, associating with "Python" does, in fact, open the file in Spyder. Perhaps this is a result of the shortcut target using |
@jaimergp, actually there is still an issue with the registry when removing an environment.
The registry key is removed, so perhaps it is trying to delete it again and it's no longer there? |
Also, FYI, |
Yes, this is a known issue: conda/conda#11092. I'll look into the other reports, thanks for giving it a try! Edit: Found these resources. Writing them down here for future reference:
|
Apparently Windows wants us to use "indirect strings" for those Progids attributes. We can't just put the text directly there. Instead, we are asked to bundle the custom strings in a resource binary ( Writing a PE file from scratch is technically possible with |
Huh, turns out at least one more person in the world has looked into this and reported that Windows 10 does support raw strings without the PE indirection. That simplifies things drastically. I'll open a PR once I can push to the repo. |
I'm wondering about this now. |
I think you are correct; it is exactly just a renamed launcher designed to run a file of its own name
Indeed, doing as you suggest and replacing the shortcut target results in Spyder launching without a cmd window 😄. However, the Notably, |
Nope, this work-around does not work. Apparently, |
Pity, that's a current We could add the feature in conda-build + conda but only recent versions would be compatible and we are looking at a September release the earliest. |
Ah, it's already non-noarch. What if you copy # -*- coding: utf-8 -*-
import re
import sys
from YOUR.MODULE import YOUR_FUNCTION
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(YOUR_FUNCTION()) |
🤔 |
Yes, my suggestion is to not generate the entry point in Windows and instead do it by hand in the build script. This way you get rid of the post-link / pre-unlink scripts. |
Note: this does not appear to establish file type association (conda/menuinst#185)
Thanks! |
Note: this does not appear to establish file type association (conda/menuinst#185)
Checklist
What happened?
@jaimergp, I get several errors when using
file_extensions
. Theconstructor
-based installer successfully installs the environment and shortcuts, however file types don't seem to be associated with Spyder, i.e. Spyder is not an available application to "open with" for expected file types.Additionally, attempting to uninstall or install with
menuinst
results in the following errors.Attempt to uninstall shortcut
Attempt to install shortcut
I get the same errors whether I run the installer as administrator or not, except the traceback file paths are
C:\ProgramData\spyder-6...
instead. The first error appears to result because thespyder-6.AssocFilec
registry key was not created as expected. I'm puzzled why the second error occurs even when run from a cmd window with administrator privileges: why wasn't aPermissionError
raised whenmenuinst
was run from the installer?.Conda Info
Conda Config
Conda list
Additional Context
spyder-menu.json
The text was updated successfully, but these errors were encountered: