1

I'm trying to use a piece of software called "bundler_sfm" which is executed using a python script.

The software I'm trying to use is available here, the script is in the utils directory if you want to have a look.

When trying to run it I get the following python error:

File "/usr/lib/python2.7/subprocess.py", line 493, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory

The code that leads to this error is as follows:

# Extract SIFT data
if verbose:
    with open(pgm_filename, 'rb') as fp_in:
        with open(key_filename, 'wb') as fp_out:
            subprocess.call(BIN_SIFT, stdin=fp_in, stdout=fp_out)

I've looked at various other answers with similar errors but am still at a loss on how to fix this problem.

I'm trying to run this in the terminal on elementary OS.

Any assistance would be greatly appreciated.

thepurpleowl
  • 147
  • 4
  • 15
nbdy_
  • 729
  • 1
  • 9
  • 18
  • Are you on a linux / unix-like operating system? Can you locate the "sift" binary? Try executing: "which sift" or try executing "find / -name "sift" type -f" – Joe Young Mar 04 '15 at 16:09
  • Yes I'm using elementary OS (linux). I downloaded the sift binary myself from [here](http://www.cs.ubc.ca/~lowe/keypoints/) and it's in the /bin folder of the program. My LD_LIBRARY_PATH includes the path to the folder containing this binary (these are all instructions I followed as per the github page I linked above), and running echo $LD_LIBRARY_PATH confirms that the path is included. – nbdy_ Mar 04 '15 at 16:14
  • ok, you know the path where you have utils/bundler.py? In the same parent folder of utils looks like there will be a bin folder there too. Can you try copying the sift binary to that particular bin folder? The code looks like it's expecting to find the sift binary file in the bin folder that's in the same parent folder as the utils folder. – Joe Young Mar 04 '15 at 16:17
  • It is in that folder =] sorry my response probably wasn't as clear as it should have been haha. Thanks for your help! – nbdy_ Mar 04 '15 at 16:19
  • Ok, sorry. Well this will be quite hackish, but you could try modifying the source code and print out what the script thinks is BIN_SIFT right before calling the subprocess.call: print BIN_SIFT – Joe Young Mar 04 '15 at 16:25
  • Aha! You're a genius! It's definitely looking in the wrong place. I added the code print "BIN_SIFT = " + BIN_SIFT and the result is: BIN_SIFT = /home/jeff/Apps/bundler_sfm/utils/../bin/sift and this is definitely what's causing the problem... I'll try hard code the path for BIN_SIFT. Any further input you have would be great though. – nbdy_ Mar 04 '15 at 16:33
  • Cool. If you don't feel like working out the path resolution issues, you can assign the path to sift to the BIN_SIFT variable on line 55. See my answer. – Joe Young Mar 04 '15 at 16:40

1 Answers1

0

Already worked it out in the comments, but just for an answer:

Worked out the location where the utility thinks the sift binary is located by printing out BIN_SIFT before calling subprocess.call() method.

Realized this path was incorrect

As a hackish work-around, hard code the correct path to line 55 of bundler.py as a string inside of a list:

BIN_SIFT = ["/real/path/to/sift"]
Joe Young
  • 5,749
  • 3
  • 28
  • 27
  • Think I jumped the gun, made the change, same error occurs. I think it's something to do with python since other people have asked questions about this error with other programs. – nbdy_ Mar 04 '15 at 16:49
  • Is it failing on the same line number with respect to bundler.py? What are the permissions on the sift binary file? Read and Execute for the user you're executing bundler.py as? – Joe Young Mar 04 '15 at 17:00
  • Sift permissions: -rwxrwxr-x 1 jeff jeff 45070 Sep 17 2011 sift. Error is pointing to the line subprocess.call(BIN_SIFT, stdin=fp_in, stdout=fp_out) – nbdy_ Mar 04 '15 at 17:03
  • Ok, let's try one more hack. Surround the path to the sift binary with brackets to turn it into a list and see if that changes anything. – Joe Young Mar 04 '15 at 17:39
  • Can you write out exactly how you execute this utility? Even including the prompt along with what you type at the prompt might help. I have a long shot idea. – Joe Young Mar 04 '15 at 20:33
  • ~/Apps/bundler_sfm/utils/bundler.py --verbose --no-parallel – nbdy_ Mar 05 '15 at 03:40
  • Can you try changing directory to: ~/Apps/bundler_sfm/utils/ Then execute the utility with the dot slash method like so: ./bundler.py --verbose --no-parallel Make sure the bundler.py file has execute permissions. – Joe Young Mar 05 '15 at 10:02
  • the script needs to be run from a directory containing images which the script will work on – nbdy_ Mar 06 '15 at 11:31
  • Ok, you can still cd to the directory containing the images, but try executing the script using dot slash "./" plus the full path to the script (avoiding tilde shortcut to your home directory). I suspect that the way the MOD_PATH is generated using "os.path.dirname(__file__)" might be causing the same issues seen here: http://stackoverflow.com/questions/15725273/python-oserror-errno-2-no-such-file-or-directory – Joe Young Mar 06 '15 at 12:25