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

Thorlabs Tdc error with artiq 2.0 #627

Closed
danielkienzlerNIST opened this issue Nov 24, 2016 · 12 comments
Closed

Thorlabs Tdc error with artiq 2.0 #627

danielkienzlerNIST opened this issue Nov 24, 2016 · 12 comments
Milestone

Comments

@danielkienzlerNIST
Copy link

danielkienzlerNIST commented Nov 24, 2016

running the controller:
(artiq-main_20161103_qc2) C:\Users\Rabi\Desktop>thorlabs_tcube_controller -P tdc
001 -d COM5 --bind 132.163.182.102 -p 3270

and then using artiq_rpctool to control the controller:

(artiq-main_20161103_qc2) C:\Users\Rabi>artiq_rpctool 132.163.182.102 3270 call get_status_bits
Traceback (most recent call last):
  File "C:\Anaconda3\envs\artiq-main_20161103_qc2\Scripts\artiq_rpctool-script.py", line 10, in <module>
    load_entry_point('artiq==2.0', 'console_scripts', 'artiq_rpctool')()
  File "C:\Anaconda3\envs\artiq-main_20161103_qc2\lib\site-packages\artiq\frontend\artiq_rpctool.py", line 139, in main
    call_method(remote, args.method, args.args)
  File "C:\Anaconda3\envs\artiq-main_20161103_qc2\lib\site-packages\artiq\frontend\artiq_rpctool.py", line 83, in call_method
    ret = method(*[eval(arg) for arg in args])
  File "C:\Anaconda3\envs\artiq-main_20161103_qc2\lib\site-packages\artiq\protocols\pc_rpc.py", line 177, in proxy
    return self.__do_rpc(name, args, kwargs)
  File "C:\Anaconda3\envs\artiq-main_20161103_qc2\lib\site-packages\artiq\protocols\pc_rpc.py", line 169, in __do_rpc
    return self.__do_action(obj)
  File "C:\Anaconda3\envs\artiq-main_20161103_qc2\lib\site-packages\artiq\protocols\pc_rpc.py", line 163, in __do_action
    raise_packed_exc(obj["exception"])
  File "C:\Anaconda3\envs\artiq-main_20161103_qc2\lib\site-packages\artiq\protocols\packed_exceptions.py", line 42, in raise_packed_exc
    raise exc
AttributeError: '_WindowsSelectorEventLoop' object has no attribute '_proactor'

Tried several Thorlabs diver versions including the one used by Raghu.
Artiq version: 2.0
Works with artiq 1.0

@danielkienzlerNIST danielkienzlerNIST changed the title Thorlabs Tdc error Thorlabs Tdc error with artiq 2.0 Nov 24, 2016
@sbourdeauducq
Copy link
Member

Can you try applying the patch above?

@sbourdeauducq sbourdeauducq added this to the 2.1 milestone Nov 24, 2016
@sbourdeauducq
Copy link
Member

And FYI ARTIQ does not use the Thorlabs driver.

jordens added a commit that referenced this issue Nov 24, 2016
* master:
  rtio: support differential ttl
  RELEASE_NOTES: int(a, width=b) removal, use int32/64
  pc_rpc: use ProactorEventLoop on Windows (#627)
@r-srinivas
Copy link

And FYI ARTIQ does not use the Thorlabs driver.

On Windows, can you change the thorlabs device to use a virtual com port without installing the driver?

@danielkienzlerNIST
Copy link
Author

(artiq-main_20161103_qc2) C:\Users\Rabi>artiq_rpctool 132.163.182.102 3270 call
get_status_bits
Traceback (most recent call last):
File "C:\Anaconda3\envs\artiq-main_20161103_qc2\Scripts\artiq_rpctool-script.p
y", line 10, in
load_entry_point('artiq==2.0', 'console_scripts', 'artiq_rpctool')()
File "C:\Anaconda3\envs\artiq-main_20161103_qc2\lib\site-packages\artiq\fronte
nd\artiq_rpctool.py", line 139, in main
call_method(remote, args.method, args.args)
File "C:\Anaconda3\envs\artiq-main_20161103_qc2\lib\site-packages\artiq\fronte
nd\artiq_rpctool.py", line 83, in call_method
ret = method(*[eval(arg) for arg in args])
File "C:\Anaconda3\envs\artiq-main_20161103_qc2\lib\site-packages\artiq\protoc
ols\pc_rpc.py", line 178, in proxy
return self.__do_rpc(name, args, kwargs)
File "C:\Anaconda3\envs\artiq-main_20161103_qc2\lib\site-packages\artiq\protoc
ols\pc_rpc.py", line 170, in __do_rpc
return self.__do_action(obj)
File "C:\Anaconda3\envs\artiq-main_20161103_qc2\lib\site-packages\artiq\protoc
ols\pc_rpc.py", line 164, in __do_action
raise_packed_exc(obj["exception"])
File "C:\Anaconda3\envs\artiq-main_20161103_qc2\lib\site-packages\artiq\protoc
ols\packed_exceptions.py", line 42, in raise_packed_exc
raise exc
AttributeError: '_WindowsSelectorEventLoop' object has no attribute '_proactor'

Sorry, something went wrong.

@sbourdeauducq
Copy link
Member

Are you sure the patch is applied correctly to the ARTIQ installation you are running?

Sorry, something went wrong.

@sbourdeauducq
Copy link
Member

You need to edit C:\Anaconda3\envs\artiq-main_20161103_qc2\lib\site-packages\artiq\protoc ols\pc_rpc.py

@danielkienzlerNIST
Copy link
Author

I'm not sure, but I wouldn't know if not.
Yes, I edited that file. Is there something I'm missing?
The console printout also shows different line numbers, so I guess it is using the modified file

@sbourdeauducq
Copy link
Member

sbourdeauducq commented Nov 30, 2016

I'm not sure, but I wouldn't know if not.

Add a print into that file to check that ProactorEventLoop is correctly created and used.
The root cause of the problem is SelectorEventLoop (the default asyncio event loop on Windows) does not support serial ports and you need to use ProactorEventLoop. Quite clearly, the patch does that, so it is surprising that you still see a reference to SelectorEventLoop in your backtrace.

@sbourdeauducq
Copy link
Member

@danielkienzlerNIST ping

@danielkienzlerNIST
Copy link
Author

code:
See Server for a description of the parameters.
"""
if os.name == "nt":
loop = asyncio.ProactorEventLoop()
asyncio.set_event_loop(loop)
print("simple_server_loop:1")
else:
loop = asyncio.get_event_loop()
print("simple_server_loop:2")
try:

out:
simple_server_loop:1

@sbourdeauducq
Copy link
Member

You could have just done print(loop).

And you still see the problem after it has printed that?

@sbourdeauducq
Copy link
Member

Fixed.

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

3 participants