1. Benoît Allard
  2. galileo
  3. Issues
Issue #41 duplicate

TypeError: write() takes at most 4 arguments (5 given)

Anonymous created an issue

When trying to run the program, this error is returned:

# A serious error happened, which is probably due to a
# programming error. Please open a new issue with the following
# information on the galileo bug tracker:
#    https://bitbucket.org/benallard/galileo/issues/new
# ./run: 0.4dev
# Python: 2.7.5+ (default, Sep 19 2013, 13:48:49) [GCC 4.8.1]
# Platform: Linux aaa 3.11.0-17-generic #31-Ubuntu SMP Mon Feb 3 21:52:43 UTC 2014 x86_64 x86_64
# pyusb: 1.0.0b2
# requests: 1.2.3
# yaml: own version
Traceback (most recent call last):
  File "./run", line 5, in <module>
  File "/home/aaa/Downloads/fitbit/benallard-galileo-66a5df283a03/galileo/main.py", line 250, in main
  File "/home/aaa/Downloads/fitbit/benallard-galileo-66a5df283a03/galileo/main.py", line 185, in sync
    total, success, skipped = syncAllTrackers(config)
  File "/home/aaa/Downloads/fitbit/benallard-galileo-66a5df283a03/galileo/main.py", line 35, in syncAllTrackers
  File "/home/aaa/Downloads/fitbit/benallard-galileo-66a5df283a03/galileo/tracker.py", line 37, in disconnect
    self.dongle.ctrl_write([2, 2])
  File "/home/aaa/Downloads/fitbit/benallard-galileo-66a5df283a03/galileo/dongle.py", line 115, in ctrl_write
    l = self.dev.write(0x02, data, self.CtrlIF.bInterfaceNumber, timeout)
TypeError: write() takes at most 4 arguments (5 given)

Comments (8)

  1. dudella

    Can you explain what does this mean: "remove the third parameter in the calls to write and read in galileo/dongle.py". I can't seem to understand what that third parameter is I'm supposed to remove...

  2. Benoît Allard repo owner

    Sure, let me try.

    In the file galileo/dongle.py, you have a lot of lines. One of them is breaking (actually four, but we'll come back to this later), in your case, the line 115. In this line, there is a call of the write method (before the opening parenthesis), with four parameters (inside the parenthesis, separated by commas). They are also called arguments. The write method belongs to the pyusb package. The version of pyusb you decided to install changed the way this method works, and request that it only takes three parameters (instead of the four we actually give). For it to work again with your version, you need to remove the third parameter (and the comma that separates it from the other ones). If you do that correctly, and try to run galileo again, you should get a similar error as the one you pasted in this issue, but with a different line number in the last line. This is the place where you need to do it again. In total, you will need to repeat the same process four times (for the four breaking lines).

    What happened here, is that the people that maintain "pyusb" realized that they could provide the same functionality without requiring us to provide the information in the "endpoint" parameter (that third one), and decided to remove it, breaking all application that use this method at the same time. We will provide a fix for this, of course, but we will first wait for an official release of the pyusb package. Who knows, maybe more stuff will change in the meantime, or maybe they will realize that they actually need that "endpoint" and revert the change. Or ...

    That's the reason why we recommend using an official "tagged release" of pyusb, as we know that those are working.

    I hope I explained clearly what I meant, if it's not the case, feel free to post an update here.

  3. Log in to comment