Git Product home page Git Product logo

pyvxi11's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

bcr jbaltes

pyvxi11's Issues

Problem opening connections on 64-bit machines

HI,

I really appreciate the python-only VXI-11 implementation (especially after fighting for hours with assorted, broken, SWIG-based implementations).

I found an issue though with 64-bit machines...

Here's the traceback:

$ vxi11-cli ds1204b

Traceback (most recent call last):
File "/home/tymm/pyenvs/notebook/bin/vxi11-cli", line 9, in
load_entry_point('pyvxi11==0.3', 'console_scripts', 'vxi11-cli')()
File "/home/tymm/pyenvs/notebook/local/lib/python2.7/site-packages/pyvxi11-0.3-py2.7.egg/pyvxi11/vxi11_cli.py", line 60, in main
v.open()
File "/home/tymm/pyenvs/notebook/local/lib/python2.7/site-packages/pyvxi11-0.3-py2.7.egg/pyvxi11/vxi11.py", line 178, in open
self.vxi11_client.create_link(id(self), 0, 0, self.name)
File "/home/tymm/pyenvs/notebook/local/lib/python2.7/site-packages/pyvxi11-0.3-py2.7.egg/pyvxi11/vxi11.py", line 138, in create_link
self.unpacker.unpack_create_link_resp)
File "/home/tymm/pyenvs/notebook/local/lib/python2.7/site-packages/pyvxi11-0.3-py2.7.egg/pyvxi11/rpc.py", line 258, in make_call
pack_func(args)
File "/home/tymm/pyenvs/notebook/local/lib/python2.7/site-packages/pyvxi11-0.3-py2.7.egg/pyvxi11/vxi11.py", line 72, in pack_create_link_parms
self.pack_int(id)
File "/usr/lib/python2.7/xdrlib.py", line 57, in pack_int
self.__buf.write(struct.pack('>l', x))
struct.error: 'l' format requires -2147483648 <= number <= 2147483647

issue comes from interaction between code in Vxi11::open() and Vxi11Packer::pack_create_link_parms(), as the passed ID can exceed the value that can be stored in an int:

def open(self):
    log.info('Opening connection to %s', self.host)
    error, link_id, abort_port, max_recv_size = \
            self.vxi11_client.create_link(id(self), 0, 0, self.name)

...

def pack_create_link_parms(self, params):
    id, lock_device, lock_timeout, device = params

    self.pack_int(id)

I threw together a quick hack without digging too deeply into the code; it's flawed I'm sure, but gets things working for me for now -- just mask off the high bits of the id. I imagine this will come back to bite me at some point.

           self.vxi11_client.create_link(id(self) & 0x7fffffff, 0, 0, self.name)

If you have suggestions on a proper fix, would greatly appreciate it.

Thanks!

-Tymm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.