/usr/share/bleachbit/Unix.py:45: ImportWarning

Bug #1143297 reported by MM
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
BleachBit
Fix Released
Medium
Unassigned
bleachbit (Arch Linux)
New
Undecided
Unassigned

Bug Description

Hi,

I'm running Slackware 14.0 x86 with only OpenBox as my DE and I compiled BleachBit from source...

Here's the script I use to compile it;

-----------------------------------------------------------------

#!/bin/bash
# SlackBuild script for bleachbit.

PRGNAM=bleachbit
VERSION=${VERSION:-0.9.5}
BUILD=${BUILD:-1}
TAG=${TAG:-_sar}

ARCH=noarch

CWD=$(pwd)
TMP=${TMP:-/tmp/sar}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R u+w,go+r-w,a-s .

# Exclude the Windows-only cleaners from the source per author's instructions.
grep -l os=.windows. cleaners/*xml | xargs rm -f

make install DESTDIR=$PKG prefix=/usr

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a COPYING PKG-INFO README doc/* $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README$TAG

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc
cat $CWD/doinst.sh > $PKG/install/doinst.sh

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}

-----------------------------------------------------------------

When I run BleachBit from the command line I get this output;

info: starting BleachBit version 0.9.5
/usr/share/bleachbit/Unix.py:45: ImportWarning: Not importing directory '/usr/share/gnome': missing __init__.py
  import gnome.vfs

Slackware doesn't use Gnome, but it does have some Gnome libs, but I don't have many of these installed and I don't use gvfs either...

I woudn't say this is a bug, rather reporting something I don't have... So what feature(s) will I be missing without this?

The source code doesn't have any README that lists requirements that's why I'm reporting this, maybe one can be written up...

Maybe in the future a version of BleachBit can be made available that doesn't require gnome.vfs....

THANKS

Revision history for this message
Andrew Ziem (ahziem1) wrote :

BleachBit 0.9.5 does not require gnome.vfs. When it is not installed, you lose a small subset of the 'broken shortcuts' cleaner related to unregistered MIME type

I think the warning you are getting is actually not from BleachBit. I think it comes a partial Gnome install (?) because of the missing __init__.py problem in a non-BleachBit directory.

Revision history for this message
MM (mmme) wrote :

Hi,

I have no Gnome installed, Slackware does not come with Gnome...

The only thing I have installed into /usr/share/gnome is libcanberra...

Ok I'm lost, how can I run BleachBit and something else create this warning? Beacuse you're saying this might not be coming from BleachBit, I don't follow how that's possible...

What about line 45 in /usr/share/bleachbit/Unix.py? Seems pretty clear BleachBit wants to import if possible gnome.vfs...

HAVE_GNOME_VFS = True
try:
    import gnomevfs
except:
    try:
        # this is the deprecated name
        import gnome.vfs
    except:
        HAVE_GNOME_VFS = False
    else:
        gnomevfs = gnome.vfs

THANKS

Revision history for this message
Andrew Ziem (ahziem1) wrote :

If you were to rename /usr/share/gnome and then do 'import gnome.vfs' and 'import gnomevfs' in Python, you wouldn't get the error.

So I guess Python is throwing the message.

Try creating a blank /usr/share/gnome/__init__.py file

Revision history for this message
MM (mmme) wrote : Re: [Bug 1143297] Re: /usr/share/bleachbit/Unix.py:45: ImportWarning
Download full text (3.4 KiB)

Hi Andrew,

Sorry for not getting back sooner, so creating a blank __init__.py file
works.

SO if someone doesn't have this is there a way you can create a fix for
this?

I'm not a coder so I don't understand this, so Bleachbit uses python, but
if Bleachbit doesn't need this, then I don't get why this is happening.

As an example I use other python apps that I've compiled in Slack and they
don't complain about this, so that makes me wonder, this isn't realated to
something to do with Bleachbit?

THANKS

On Wed, Mar 6, 2013 at 5:11 PM, Andrew Ziem <email address hidden> wrote:

> If you were to rename /usr/share/gnome and then do 'import gnome.vfs'
> and 'import gnomevfs' in Python, you wouldn't get the error.
>
> So I guess Python is throwing the message.
>
> Try creating a blank /usr/share/gnome/__init__.py file
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1143297
>
> Title:
> /usr/share/bleachbit/Unix.py:45: ImportWarning
>
> Status in BleachBit: disk space and privacy file cleaner:
> New
>
> Bug description:
> Hi,
>
> I'm running Slackware 14.0 x86 with only OpenBox as my DE and I
> compiled BleachBit from source...
>
> Here's the script I use to compile it;
>
> -----------------------------------------------------------------
>
> #!/bin/bash
> # SlackBuild script for bleachbit.
>
> PRGNAM=bleachbit
> VERSION=${VERSION:-0.9.5}
> BUILD=${BUILD:-1}
> TAG=${TAG:-_sar}
>
> ARCH=noarch
>
> CWD=$(pwd)
> TMP=${TMP:-/tmp/sar}
> PKG=$TMP/package-$PRGNAM
> OUTPUT=${OUTPUT:-/tmp}
>
> set -e
>
> rm -rf $PKG
> mkdir -p $TMP $PKG $OUTPUT
> cd $TMP
> rm -rf $PRGNAM-$VERSION
> tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
> cd $PRGNAM-$VERSION
> chown -R root:root .
> chmod -R u+w,go+r-w,a-s .
>
> # Exclude the Windows-only cleaners from the source per author's
> instructions.
> grep -l os=.windows. cleaners/*xml | xargs rm -f
>
> make install DESTDIR=$PKG prefix=/usr
>
> mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
> cp -a COPYING PKG-INFO README doc/* $PKG/usr/doc/$PRGNAM-$VERSION
> cat $CWD/$PRGNAM.SlackBuild >
> $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
> cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README$TAG
>
> mkdir -p $PKG/install
> cat $CWD/slack-desc > $PKG/install/slack-desc
> cat $CWD/doinst.sh > $PKG/install/doinst.sh
>
> cd $PKG
> /sbin/makepkg -l y -c n
> $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
>
>
> -----------------------------------------------------------------
>
> When I run BleachBit from the command line I get this output;
>
> info: starting BleachBit version 0.9.5
> /usr/share/bleachbit/Unix.py:45: ImportWarning: Not importing directory
> '/usr/share/gnome': missing __init__.py
> import gnome.vfs
>
>
> Slackware doesn't use Gnome, but it does have some Gnome libs, but I
> don't have many of these installed and I don't use gvfs either...
>
> I woudn't say this is a bug, rather reporting something I don't
> have... So what feature(s) will I be missing without this?
>
> The source code doesn't have any README that lists requirements that's
> why...

Read more...

Revision history for this message
Andrew Ziem (ahziem1) wrote :

This looks like a packaging issue in Slackware for Gnome-Python. There looks to be nothing BleachBit or even the BleachBit Slackware package (which I don't maintain) can do.

Changed in bleachbit:
status: New → Invalid
Revision history for this message
MM (mmme) wrote :

Hi Andrew,

I don't recall if I showed you the Slackbuild page for Bleachbit, but here it is;

http://slackbuilds.org/repository/14.0/system/bleachbit/

Notice the contents of 'bleachbit.SlackBuild'?

All the Slackbuild script does is run this command; make install DESTDIR=$PKG prefix=/usr

This is the message from the terminal;

/usr/share/bleachbit/Unix.py:
45: ImportWarning: Not importing directory '/usr/share/gnome': missing __init__.py
    import gnome.vfs

This is your code Unix.py below at line 45;

HAVE_GNOME_VFS = True
try:
    import gnomevfs
except:
    try:
        # this is the deprecated name
        import gnome.vfs
    except:
        HAVE_GNOME_VFS = False
    else:
        gnomevfs = gnome.vfs

What does line 45 of Unix.py have to do with a Slackware package issue?

THANKS

Revision history for this message
MM (mmme) wrote :

All I see is that Unix.py below line 45 of your code is looking for gnome.vfs and since I don't have it, it's spitting out a complaint for it...

HAVE_GNOME_VFS = True
try:
    import gnomevfs
except:
    try:
        # this is the deprecated name
        import gnome.vfs
    except:
        HAVE_GNOME_VFS = False
    else:
        gnomevfs = gnome.vfs

This certainly looks like Bleachbit is looking for gnome.vfs and if not can you please explain to me what these contents above mean?

THANKS

Revision history for this message
MM (mmme) wrote :

Sorry I forgot to add another comment, if Bleachbit doesn't require gnome.vfs, then all I understand is that for Line45 of Unix.py that is just and option if it's installed?

So if this is just an option if it's installed can you please do something about the message, because if it's an option then it should not be complaining, even if it is a warning, it seems misleading, maling someone think they're missing something they need when they don't

/usr/share/bleachbit/Unix.py:45: ImportWarning: Not importing directory '/usr/share/gnome': missing __init__.py
  import gnome.vfs

THANKS Andrew....

Revision history for this message
MM (mmme) wrote :

TYPO: MAKING someone think they're missing something they need when they don't

Revision history for this message
Mélodie (meets) wrote :

Hi,

I am hitting this bug in Archlinux, using an Openbox environement with Bleachbit. ie: if I start bleachbit from the console and or from the console with "gksu" to be able to clean the sections of the system I selected in the Bleachbit configuration.

$ uname -a
Linux squirrel 3.14.6-1-ARCH #1 SMP PREEMPT Sun Jun 8 10:08:38 CEST 2014 x86_64 GNU/Linux

Nom : bleachbit
Version : 1.2-1

I haven't yet tried the creation of an empty /usr/share/gnome/__init__.py file as Bleachbit is at work right now, but I will.

Thanks for taking care of this bug.

Regards,
Mélodie

Revision history for this message
Andrew Ziem (ahziem1) wrote :

Mélodie: Do you mean you can successfully start BleachBit from the application menu but not from the console?

I'm still not sure what to do about this because it seems the problem is not in BleachBit itself.

Revision history for this message
Andrew Ziem (ahziem1) wrote :

Reopened

Still an issue for Slackware
http://bleachbit.sourceforge.net/node/1196#comment-1993

gnome.vfs is deprecated

A potential alternative to gnomevfs.mime_get_all_applications() is gio.app_info_get_all_for_type()

Changed in bleachbit:
status: Invalid → Triaged
importance: Undecided → Medium
milestone: none → 1.12
Revision history for this message
Andrew Ziem (ahziem1) wrote :

Fixed in 1c4a117 by switching from GnomeVFS to GIO

If anyone would like to test, you can checkout the latest BleachBit from GitHub or wait for the beta release

Changed in bleachbit:
status: Triaged → Fix Committed
Revision history for this message
Andrew Ziem (ahziem1) wrote :

To confirm the fix, please test the fix in BleachBit 1.11 beta
https://www.bleachbit.org/news/bleachbit-1110-beta

Changed in bleachbit:
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.