[Errno 13] Permission denied: '/home/$USER_phatch'

Bug #344548 reported by Fabián Rodríguez on 2009-03-17
Affects Status Importance Assigned to Milestone

Bug Description

If files are in the home directory, Phatch fails with a permission denied error, as it tries to create "/home/$USER_phatch" which it obviously doesn't have right to.

See attached screenshot.

Related branches

Fabián Rodríguez (magicfab) wrote :
Stani (stani) wrote :

Does shutter provide phatch integration? If yes, which version you have installed so I can reproduce the problem? I just installed shutter, but I see no reference to Phatch. At first look to your screenshot, it looks like the path in the save action is set wrong. Use the image inspector to see correct path variables.

Changed in phatch:
assignee: nobody → stani
status: New → Incomplete
Fabián Rodríguez (magicfab) wrote :

You need to install Phatch, then it will show up in the list of "Open with..." options.

Stani (stani) wrote :

I split this bug in two seperate bug reports:
- /home/$USER_phatch permission
- "open with" phatch integration on several selected images

Changed in phatch:
importance: Undecided → Low
status: Incomplete → Confirmed
description: updated
Stani (stani) wrote :

In fact this behaviour of Phatch is correct as it tries it to save in the folder which specified by the action list. I plan that in a future version of Phatch in such case will make an exception and place the results on the desktop or on ~/phatch.

As a temporary solution for Shutter, go to the preferences in Shutter and choose in General>Folder "~/shutter" (/home/magifab/shutter in your case) until a new version of Phatch provides a solution.

Changed in phatch:
importance: Low → Medium
status: Confirmed → In Progress
Stani (stani) wrote :
Download full text (3.7 KiB)

This has been fixed upstream in bzr. The new behaviour is that from now that in case of a permission error, images will be saved on desktop instead.

$ bzr diff
=== modified file 'phatch/actions/save.py'
--- phatch/actions/save.py 2009-04-14 22:29:45 +0000
+++ phatch/actions/save.py 2009-05-25 16:38:11 +0000
@@ -24,6 +24,11 @@
 from core.translation import _t,new
 from imtools import get_quality, get_size

+from core.lib.desktop import DESKTOP_FOLDER, USER_FOLDER
+ DESKTOP_FOLDER = os.path.expanduser('~/phatch')
 JPG = ['jpg','jpeg','jpe']
 PNG = ['png']
 TYPE = '<%s>'%_t('type')
@@ -72,7 +77,17 @@
             dpi = self.get_field('Resolution',info)
             if setting('create_missing_folders'):
- self.ensure_path(folder)
+ try:
+ self.ensure_path(folder)
+ except OSError, message:
+ base = os.path.basename(filename)
+ photo.log += 'Could not save "%s" in "%s":\n%s\n'\
+ %(base,folder,message)
+ photo.log += 'Will try to save in "%s" instead.\n'\
+ self.ensure_path(DESKTOP_FOLDER)
+ filename = os.path.join(DESKTOP_FOLDER,base)
             #construct options
             options = {'dpi' : (dpi,dpi)}
             if self.is_type(typ,PNG):

=== added file 'phatch/core/lib/desktop.py'
--- phatch/core/lib/desktop.py 1970-01-01 00:00:00 +0000
+++ phatch/core/lib/desktop.py 2009-05-25 16:10:46 +0000
@@ -0,0 +1,47 @@
+# Copyright (C) 2007-2008 www.stani.be
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/
+"""Cross platform library to locate the desktop folder."""
+import os
+import re
+import sys
+USER_FOLDER = os.path.expanduser('~')
+if sys.platform.startswith('win'):
+ # Windows
+ from win32com.shell import shell, shellcon
+ DESKTOP_FOLDER = shell.SHGetFolderPath(0, shellcon.CSIDL_DESKTOP,
+ None, 0)
+elif sys.platform.startswith('darwin'):
+ # Mac: verify this!
+ DESKTOP_FOLDER = os.path.expanduser('~/Desktop')
+ # Linux
+ user_dirs = os.path.expanduser('~/.config/user-dirs.dirs')
+ if os.path.exists(user_dirs):
+ DESKTOP_FOLDER = os.path.expanduser(
+ re.search('XDG_DESKTOP_DIR="(.*?)"',open(user_dirs).read())\
+ .group(1).replace('$HOME','~'))
+ else:
+ D...


Changed in phatch:
status: In Progress → Fix Committed
Stani (stani) on 2009-09-30
Changed in phatch:
milestone: none → 0.2.1
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers