Victor Aurélio
Victor Aurélio

Reputation: 2565

os.path.isfile alternative

I'm having problem with os.path.isfile, for example, this following code is part of my program:

for a in args:
    if not os.path.isfile(a):
        print _("Error: File not found: %(name)s  Ignoring...") % {'name': a}
    else:
        self.isup.queue(a)

and i have file called "box9.png" in my home folder, if i run:

% echo $PWD
/home/<username>
% /usr/bin/program-name box9.png
Error: File not found: box9.png  Ignoring...

but following work:

% echo $PWD
/home/<username>
% /usr/bin/program-name ~/box9.png
[program continue...]

can someone help me ?

I'm using Python 2.7

Upvotes: 0

Views: 748

Answers (1)

Victor Aur&#233;lio
Victor Aur&#233;lio

Reputation: 2565

With help of @J.F. Sebastian i solved my problem...

/usr/bin/pyis-uploader is an shell script, that contain:

#!/bin/sh
cd /usr/lib/pyis-uploader/
python2 pyis_uploader.py $@

I replaced with:

#!/bin/sh
python2 /usr/lib/pyis-uploader/pyis_uploader.py $@

And now work as expected!

Thanks, and Sorry my horrible English.

Upvotes: 0

Related Questions