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

Bug #344548 reported by Fabián Rodríguez
2
Affects Status Importance Assigned to Milestone
Phatch
Fix Released
Medium
Stani

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

Revision history for this message
Fabián Rodríguez (magicfab) wrote :
Revision history for this message
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
Revision history for this message
Fabián Rodríguez (magicfab) wrote :

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

Revision history for this message
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
Revision history for this message
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
Revision history for this message
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
+if 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)
             #filename
             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'\
+ %DESKTOP_FOLDER
+ 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
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# 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')
+else:
+ # 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...

Read more...

Changed in phatch:
status: In Progress → Fix Committed
Stani (stani)
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.