Simple programmatic python interface available

2,504 views
Skip to first unread message

Nick Rhinehart

unread,
Feb 5, 2015, 1:30:33 PM2/5/15
to vs...@googlegroups.com
Inspired by the earlier thread on programmatic interfaces, I've created a simple interface in python (github link: https://github.com/nrhine1/vsfm_util)

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 http://ccwu.me/vsfm/ui.ini

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!


-Nick


Changchang Wu

unread,
Feb 5, 2015, 6:10:05 PM2/5/15
to vs...@googlegroups.com
This is awesome!

Eugen Funk

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

Srikanth Vidyasagar Sadhu

unread,
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 vsfm_socket_util.py.

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?

Thanks,
Vidyasagar.

Caramel Woodpecker

unread,
Feb 16, 2016, 5:11:55 AM2/16/16
to vs...@googlegroups.com
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/test_vsfm_socket_util.py ; exit;

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

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

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

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

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

logout

Saving session...

...copying shared history...

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

...completed.


[Process completed]


Nick Rhinehart

unread,
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

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

Try calling
python test_vsfm_socket_util.py

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

to the top of test_vsfm_socket_util.py

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

HTH,
Nick

Kostas Manolopoulos

unread,
May 31, 2017, 6:56:32 PM5/31/17
to vs...@googlegroups.com


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 vsfm_socket_util.py 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 vsfm_socket_util.py 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/test_vsfm_socket_util.py", line 8, in <module>
    i = vsfmu.VSFMInterface(vsfm_binary_fn = path_to_vsfm_bin)
  File "C:\Python2713\Python27\Lib\site-packages\vsfm_socket_util\type_util.py", line 18, in wrapper
    fun(self, *args, **kargs)
  File "C:\Python2713\Python27\Lib\site-packages\vsfm_socket_util\vsfm_socket_util.py", line 77, in __init__
    self.init()
  File "C:\Python2713\Python27\Lib\site-packages\vsfm_socket_util\vsfm_socket_util.py", line 90, in init
    self.vsfm_process.start()
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'):
self.init()
Reply all
Reply to author
Forward
0 new messages