{"id":1593,"date":"2023-11-18T08:32:58","date_gmt":"2023-11-17T20:32:58","guid":{"rendered":"http:\/\/p-s.co.nz\/wordpress\/?p=1593"},"modified":"2023-11-18T11:52:39","modified_gmt":"2023-11-17T23:52:39","slug":"no-good-deed-unpunished-tempfile-and-snap","status":"publish","type":"post","link":"http:\/\/p-s.co.nz\/wordpress\/no-good-deed-unpunished-tempfile-and-snap\/","title":{"rendered":"No Good Deed Unpunished &#8211; tempfile and Snap"},"content":{"rendered":"\n<p>I was finally fixing up my <a href=\"https:\/\/pypi.org\/project\/superhelp\/\" data-type=\"link\" data-id=\"https:\/\/pypi.org\/project\/superhelp\/\" target=\"_blank\" rel=\"noreferrer noopener\">superhelp<\/a> package when I noticed that the HTML output no longer displayed successfully in the web browser (whether on Firefox or Chromium).<\/p>\n\n\n\n<p>The error message in the browser was:<\/p>\n\n\n\n<p><code>File not found<\/code><\/p>\n\n\n\n<p><code>Firefox can\u2019t find the file at<br>\/tmp\/superhelp_project_output\/_home_g_Documents_python_python_scripts_superhelp_demo.py.html.<\/code><\/p>\n\n\n\n<p>At first I assumed it was because of breaking changes in a dependency or something like that &#8211; I have encountered a few as I finally try to bring my project up to date. But no &#8211; the real answer is that both Firefox and Chromium on my machine are installed as snap packages. And snap packages are isolated from system paths such as <code>\/tmp<\/code> &#8211; they use their own version (see <a href=\"https:\/\/superuser.com\/questions\/1748689\/file-tmp-in-firefox-does-not-show-contents-of-tmp\">file:\/\/\/tmp\/ in Firefox does not show contents of \/tmp<\/a>).<\/p>\n\n\n\n<p>So I can&#8217;t use the elegant Python <code>tempfile<\/code>-based solution (cross-platform, semantic, documented) and will need to manage creating the file myself. And I thought I was doing the right thing &#8230; sigh &#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was finally fixing up my superhelp package when I noticed that the HTML output no longer displayed successfully in the web browser (whether on Firefox or Chromium). The error message in the browser was: File not found Firefox can\u2019t &hellip; <a href=\"http:\/\/p-s.co.nz\/wordpress\/no-good-deed-unpunished-tempfile-and-snap\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[15,34,35],"class_list":["post-1593","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-python","tag-snap","tag-superhelp"],"_links":{"self":[{"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/posts\/1593"}],"collection":[{"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/comments?post=1593"}],"version-history":[{"count":5,"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/posts\/1593\/revisions"}],"predecessor-version":[{"id":1598,"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/posts\/1593\/revisions\/1598"}],"wp:attachment":[{"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/media?parent=1593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/categories?post=1593"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/p-s.co.nz\/wordpress\/wp-json\/wp\/v2\/tags?post=1593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}