Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: No module named 'exceptions' #2

Open
marcocamma opened this issue Dec 18, 2018 · 4 comments
Open

ImportError: No module named 'exceptions' #2

marcocamma opened this issue Dec 18, 2018 · 4 comments

Comments

@marcocamma
Copy link

marcocamma commented Dec 18, 2018

Hi,

I installed the module with pip3 and when trying to import it I get the following error:

/home/user/.local/lib/python3.5/site-packages/zaber_device/zaber_device.py in <module>()
      6 import platform
      7 import os
----> 8 from exceptions import Exception

thanks, marco

@peterpolidoro
Copy link
Member

peterpolidoro commented Dec 18, 2018

Hi. Sorry about that. I made some changes, can you please try it again now?

@marcocamma
Copy link
Author

Thanks !
indeed I can now import it without problem ... it seems not compatible with the X-MCB1 controller I have. it is seen as ttyACM0 in my machine. I may have to keep using my ugly module (that I still have to improve):
here

@peterpolidoro
Copy link
Member

What is incompatible about it? Is it because it uses the old Zaber binary format instead of their ASCII format? I wrote this library years ago and I would like to update it so it works with their newer products. I have not worked with their products since I wrote this, do they have a set of ASCII commands that work with all of their controllers?

@marcocamma
Copy link
Author

I am using ASCII too but this is what I get:

   ...: 5200,debug=True)
port = /dev/ttyACM0
Initialization time = 2.0024795532226562

In [7]: z.get_position()
request attempt: 0
request [0, 60, 0, 0, 0, 0]
------------------------------------------------------------------
ReadError                        Traceback (most recent call last)
<ipython-input-7-06629e309cdf> in <module>()
----> 1 z.get_position()

/home/thzuser/.local/lib/python3.5/site-packages/zaber_device/zaber_device.py in get_position(self)
    644         '''
    645         actuator = None
--> 646         response = self._send_request_get_response(60,actuator)
    647         return response
    648 

/home/thzuser/.local/lib/python3.5/site-packages/zaber_device/zaber_device.py in _send_request_get_response(self, command, actuator, data)
    239                     self._debug_print('request', [ord(c) for c in request])
    240                     request_attempt += 1
--> 241                     response = self._serial_interface.write_read(request,use_readline=False,size=READ_SIZE)
    242                     response_array = [ord(c) for c in response]
    243                     response_str = str(response_array)

/home/thzuser/.local/lib/python3.5/site-packages/serial_interface/serial_interface.py in write_read(self, data, use_readline, check_write_freq, max_read_attempts, delay_write, match_chars, size)
    191             if bytes_written > 0:
    192                 time.sleep(self._write_read_delay)
--> 193                 response = self._read_with_retry(use_readline,max_read_attempts,match_chars,size)
    194                 self._debug_print('response:', response)
    195             else:

/home/thzuser/.local/lib/python3.5/site-packages/serial_interface/serial_interface.py in _read_with_retry(self, use_readline, max_read_attempts, match_chars, size)
    213             self._debug_print('no response -- retrying')
    214         if not response:
--> 215             raise ReadError("No response received.")
    216         else:
    217             return response

ReadError: 'No response received.'

I'll try to debug and have a look at your code in the next days.
thanks for your answer,
marco

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants