Ticket #57 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

Patch: Preferences

Reported by: pingou Owned by: lincoln
Priority: major Milestone: 0.3.0
Component: guake Version:
Keywords: Cc:

Description

While testing the new guake 0.3 I tried to see the preferences menu.

It returns me the following error:

Traceback (most recent call last):
  File "/usr/lib64/guake/guake.py", line 936, in on_prefs_menuitem_activate
    self.show_prefs()
  File "/usr/lib64/guake/guake.py", line 710, in show_prefs
    PrefsDialog(self).show()
  File "/usr/lib64/guake/guake.py", line 173, in __init__
    self.populate_shell_combo()
  File "/usr/lib64/guake/guake.py", line 309, in populate_shell_combo
    print os.listdir(i)
OSError: [Errno 2] No such file or directory: '/home/pierrey/bin'

The directory /home/pierrey/bin is indeed in my $PATH but does not exist... I must have done something wrong somewhere...

I submit the patch based on the principle "if it happened to me it can happen to somebody else..." :)

I attached patch to the report.

Thanks for the work done :)

Attachments

guake.py-0.3.patch Download (0.7 KB) - added by pingou 5 years ago.
path-search-fix-take-2.patch Download (0.6 KB) - added by lincoln 5 years ago.

Change History

Changed 5 years ago by pingou

Changed 5 years ago by lincoln

Weird, I thought it was fixed, like described in bug #54, but I saw your patch using the "fix". To test it, I set my $PATH with many wrong paths but this bug didn't happen.

Before commiting another bogus fix, I'd like to ask you to test the attached patch, can you help me again?!

Thanks =)

ps.: to apply the patch, use the following command in the root of guake's source tree:

patch -Np1 < path-search-fix-take-2.patch

Changed 5 years ago by lincoln

Changed 5 years ago by pingou

Ok I tried your patch but I modified directly the file by hand.

Here is the diff

# diff -u guake.py-2 guake.py
--- guake.py-2	2008-07-24 16:37:11.000000000 +0200
+++ guake.py	2008-07-24 16:43:01.000000000 +0200
@@ -310,12 +310,12 @@
                     cb.append_text(possible)
 
         for i in os.environ.get('PATH', '').split(os.pathsep):
-            try:
+           if os.path.isdir(i): 
               for j in os.listdir(i):
                 if PYTHONS.match(j):
                     cb.append_text(os.path.join(i, j))
-            except:
-              pass
+           else: 
+              print 'path %s skipped' % i
 
     def populate_keys_tree(self):
         model = self.get_widget('treeview-keys').get_model()

If I start the preference menu it works, I get the correct message :

$ guake
path /home/pierrey/bin skipped

Thanks for the patch :)

Changed 5 years ago by pingou

  • owner changed from somebody to lincoln

I leave it up to you to close it :)

Changed 5 years ago by lincoln

  • status changed from new to closed
  • resolution set to fixed

This commit makes sure that only directories will be iterated, so if you have a file path in your PATH variable, guake just ignore it.

Btw I removed the skip message, because I think it's only useful for debug purposes.

Thanks for helping again =)

Note: See TracTickets for help on using tickets.