Suddenly cannot open local .py files (Python source files) as plain text
Hello.
Up until recently, I could click a link to a locally stored Python source file (.py extension) and it would display as a plain text file in Firefox. This is what I want; e.g., it is a way that I view my notes, refer to examples, and so on.
Starting a few days ago, when I click such a link, I now get a pop-up window with the two options "Open with" or "Save file." I have tried a number of things to get back to the old behavior, including deleting the handlers.json file in my Profile folder, running a full Refresh, and creating a new profile. None of these got me back to the old behavior: displaying the .py file as plain text.
If I set the "Open with" option in that pop-up window to Firefox, I just keep getting the pop-up over and over again, while a new tab is created each time.
Note: if I look at a .py file on GitHub, there is no problem: again, the file just displays.
I suspected this behavior is connected with my having installed the latest version of Python (3.9.6) a few days ago, and I just confirmed this by updating Python on another machine. That is, on the other machine, the .py file would display as plain text until just now, after I update Python there.
So, I believe the Python installation is the cause of the problem, but, nonetheless, it seems to me that I should be able to set (or unset?) something within Firefox to make .py files open as plain text, as they used to.
Any ideas?
Thanks in advance.
所有回覆 (3)
Not that many people seem to care, but just in case, for someone in the future …
When I didn’t find a solution to the above, I decided the least painful way to deal with the problem was to go into Settings > Applications in Firefox, and associate PY files with Emacs. So, now when I click a link to one of my local .py files, an Emacs window pops up, with that file in it.
Due to a typo a couple of days ago, I discovered another workaround: in the URL for the file, just append a dot, and then the proper file will open in the browser, as a plain text file, which is all I ever wanted. (Well, not all.) That is, this line in an HTML file will cause the file to open in a pop-up Emacs window …
<a href="file:///c:/some-dir/example.py">example.py</a>
… but this will open the same file, right in the browser (note the dot after the .py extension):
<a href="file:///c:/some-dir/example.py">example.py.</a>
Hi
I am sorry we were not able to look at this issue sooner, but I am glad to hear that you have found a solution to this.
Thanks for your response, @Seburo, but I would not say that my original problem is solved. I have come up with two workarounds, and practically speaking, both eliminate most of the pain. But I still would, ideally, like to be able to have a local Python source file open as a plain text file in my browser. I would also like to understand what is going on under the hood of Firefox that prevents me from doing this.
So, no urgency. But if you have some ideas, I'd be glad to hear them.