Simple programmatic python interface available

Skip to first unread message

Nick Rhinehart

Feb 5, 2015, 1:30:33 PM2/5/15
Inspired by the earlier thread on programmatic interfaces, I've created a simple interface in python (github link:

In theory, it implements all functionality available in the GUI menus, as it is programmatically constructed from the commands made available in the ui.ini file

Included is a small test script that demos a few bits of functionality.

If you already have VSFM set up, you can clone this repo and change the path in the test script to the binary, and it should without a hitch.

I hope others find this useful!


Changchang Wu

Feb 5, 2015, 6:10:05 PM2/5/15
This is awesome!

Eugen Funk

Sep 9, 2015, 3:07:59 AM9/9/15
to VisualSFM
thank you!

Srikanth Vidyasagar Sadhu

Feb 13, 2016, 9:53:09 PM2/13/16
to VisualSFM
Dear Nick,

I get the following error when I run your python test script:

pickle.PicklingError: Can't pickle <built-in method recvfrom_into of _socket.socket object at 0x000000000248CBF0>: it's not found as __main__.recvfrom_into

The source of errors seem to be self.vsfm_process.start(), self.init() in

I'm running it on Windows 64 bit. I have set the binary to VisualSFM.exe path in my system.

Can you help me in any way about this? Does the program work in Windows too?


Caramel Woodpecker

Feb 16, 2016, 5:11:55 AM2/16/16
Hi Nick,

Thank you for the interface.

Hi Changchang,

Thank-you for the program.

I've changed the path script in the test script you provided and ran it, however I am receiving "command not found".

Why would I receive this? I am not very savvy with programming languages but would REALLY like to install this software.

I would greatly appreciate any suggestions!

Thank- you :)

...This is the entire script in case you feel kind enough to assist me:

Last login: Tue Feb 16 05:02:49 on ttys001

Hookeys-MacBook-Air:~ hookey$ /Users/hookey/Downloads/vsfm_util-master/ ; exit;

/Users/hookey/Downloads/vsfm_util-master/ line 1: import: command not found

/Users/hookey/Downloads/vsfm_util-master/ line 2: import: command not found

/Users/hookey/Downloads/vsfm_util-master/ line 4: example_dir: command not found

/Users/hookey/Downloads/vsfm_util-master/ line 5: syntax error near unexpected token `example_dir'

/Users/hookey/Downloads/vsfm_util-master/ line 5: `os.chdir(example_dir)'


Saving session...

...copying shared history...

...saving history...truncating history files...


[Process completed]

Nick Rhinehart

Mar 24, 2016, 6:12:28 PM3/24/16
to VisualSFM
Hi Vidyasagar,

I haven't tried it on Windows, so I'm not sure if the test script or the interface would work. It sounds like its an error with the multiprocessing interface.

You could try to replace the multiprocessing library with pathos multiprocessing, it has less issues with pickling data for multiprocessing.

Nick Rhinehart

Mar 24, 2016, 6:14:35 PM3/24/16
to VisualSFM
Hi Woodpecker (if that is your real name)

Try calling

or adding the line
#!/usr/bin/env python

to the top of

Your shell didn't know that it was executing python code


Kostas Manolopoulos

May 31, 2017, 6:56:32 PM5/31/17

Hello friends,
Congratulations on your awesome python Interface Nick. I have a couple of questions though. I know that this script is meant to be used in Linux, but since I am a Windows user I wanted to know if is there is a possibility to make it work in this OS or I have to use Ubuntu.
If some changes happen in the code, will it be able to work? I replaced the multiprocessing with pathos.multiprocessing and the Process class replaced with Pool ,as you mentioned earlier, but it's still not working but the error log is shorter for sure :).
Also I noticed that in there's a  piece of the code that still has your bin path in it.Should I change it to mine?
Thanks in advance,
Kostas (As you can tell I am a newbie in Python :) )

Also here's my error log after using pathos :

will bind to port: 55849
Traceback (most recent call last):
  File "C:/Python2713/Python27/Lib/site-packages/vsfm_socket_util/", line 8, in <module>
    i = vsfmu.VSFMInterface(vsfm_binary_fn = path_to_vsfm_bin)
  File "C:\Python2713\Python27\Lib\site-packages\vsfm_socket_util\", line 18, in wrapper
    fun(self, *args, **kargs)
  File "C:\Python2713\Python27\Lib\site-packages\vsfm_socket_util\", line 77, in __init__
  File "C:\Python2713\Python27\Lib\site-packages\vsfm_socket_util\", line 90, in init
AttributeError: 'ProcessPool' object has no attribute 'start'

Process finished with exit code 1
And here's the path in the piece of the code I mentioned earlier:
def __init__(self, 
vsfm_binary_fn = '/home/nrhineha/dev/vsfm/bin/VisualSFM',
port = None,
host = 'localhost'):
Reply all
Reply to author
0 new messages