2017-02-24 4 views
0

Pypjlink est une API de contrôle de projecteur universelle permettant de contrôler des projecteurs sur un réseau. Voici un lien qui contiendra toutes les informations à ce sujet: https://pypi.python.org/pypi/pypjlink. Il existe également un lien vers le référentiel qui contient tous les fichiers. J'ai essayé de surmonter toutes les erreurs d'assertion, mais je n'ai pas eu trop de succès. Dès que j'en fixe un, un autre est toujours sur mon chemin. J'interroge simplement le projecteur sur l'état de l'alimentation. Voici le code dans mon fichier:Je reçois des erreurs d'assertion lors de l'utilisation de PYPJLINK, comment puis-je les corriger?

from pypjlink import Projector 
projector = Projector.from_address('10.21.24.7') 

power = projector.get('POWR') 


print power 

Ceci est toutes mes sorties de tests au cours de la dernière heure ou deux:

=== RESTART: /Users/Dustin/OneDrive/School Work/Work Study/pjlink_test.py === 

Traceback (most recent call last): 
    File "/Users/Dustin/OneDrive/School Work/Work Study/pjlink_test.py", line 4, in <module> 
    power = projector.get_errors() 
    File "/Library/Python/2.7/site-packages/pypjlink/projector.py", line 172, in get_errors 
    param = self.get('ERST') 
    File "/Library/Python/2.7/site-packages/pypjlink/projector.py", line 119, in get 
    success, response = protocol.send_command(self.f, body, '?') 
    File "/Library/Python/2.7/site-packages/pypjlink/protocol.py", line 71, in send_command 
    resp_body, resp_param = parse_response(f) 
    File "/Library/Python/2.7/site-packages/pypjlink/protocol.py", line 30, in parse_response 
    assert header == '%' 
AssertionError 
>>> 
=== RESTART: /Users/Dustin/OneDrive/School Work/Work Study/pjlink_test.py === 

Traceback (most recent call last): 
    File "/Users/Dustin/OneDrive/School Work/Work Study/pjlink_test.py", line 4, in <module> 
    power = projector.get('Power?') 
    File "/Library/Python/2.7/site-packages/pypjlink/projector.py", line 119, in get 
    success, response = protocol.send_command(self.f, body, '?') 
    File "/Library/Python/2.7/site-packages/pypjlink/protocol.py", line 67, in send_command 
    data = to_binary(req_body, req_param) 
    File "/Library/Python/2.7/site-packages/pypjlink/protocol.py", line 18, in to_binary 
    assert body.isupper() 
AssertionError 
>>> 
=== RESTART: /Users/Dustin/OneDrive/School Work/Work Study/pjlink_test.py === 

Traceback (most recent call last): 
    File "/Users/Dustin/OneDrive/School Work/Work Study/pjlink_test.py", line 4, in <module> 
    power = projector.get('Power') 
    File "/Library/Python/2.7/site-packages/pypjlink/projector.py", line 119, in get 
    success, response = protocol.send_command(self.f, body, '?') 
    File "/Library/Python/2.7/site-packages/pypjlink/protocol.py", line 67, in send_command 
    data = to_binary(req_body, req_param) 
    File "/Library/Python/2.7/site-packages/pypjlink/protocol.py", line 18, in to_binary 
    assert body.isupper() 
AssertionError 
>>> 
=== RESTART: /Users/Dustin/OneDrive/School Work/Work Study/pjlink_test.py === 

Traceback (most recent call last): 
    File "/Users/Dustin/OneDrive/School Work/Work Study/pjlink_test.py", line 4, in <module> 
    power = projector.get('POWER') 
    File "/Library/Python/2.7/site-packages/pypjlink/projector.py", line 119, in get 
    success, response = protocol.send_command(self.f, body, '?') 
    File "/Library/Python/2.7/site-packages/pypjlink/protocol.py", line 67, in send_command 
    data = to_binary(req_body, req_param) 
    File "/Library/Python/2.7/site-packages/pypjlink/protocol.py", line 20, in to_binary 
    assert len(body) == 4 
AssertionError 
>>> 
=== RESTART: /Users/Dustin/OneDrive/School Work/Work Study/pjlink_test.py === 

Traceback (most recent call last): 
    File "/Users/Dustin/OneDrive/School Work/Work Study/pjlink_test.py", line 4, in <module> 
    power = projector.get('POW') 
    File "/Library/Python/2.7/site-packages/pypjlink/projector.py", line 119, in get 
    success, response = protocol.send_command(self.f, body, '?') 
    File "/Library/Python/2.7/site-packages/pypjlink/protocol.py", line 67, in send_command 
    data = to_binary(req_body, req_param) 
    File "/Library/Python/2.7/site-packages/pypjlink/protocol.py", line 20, in to_binary 
    assert len(body) == 4 
AssertionError 
>>> 
=== RESTART: /Users/Dustin/OneDrive/School Work/Work Study/pjlink_test.py === 

Traceback (most recent call last): 
    File "/Users/Dustin/OneDrive/School Work/Work Study/pjlink_test.py", line 4, in <module> 
    power = projector.get('POWE') 
    File "/Library/Python/2.7/site-packages/pypjlink/projector.py", line 119, in get 
    success, response = protocol.send_command(self.f, body, '?') 
    File "/Library/Python/2.7/site-packages/pypjlink/protocol.py", line 71, in send_command 
    resp_body, resp_param = parse_response(f) 
    File "/Library/Python/2.7/site-packages/pypjlink/protocol.py", line 30, in parse_response 
    assert header == '%' 
AssertionError 
>>> 
=== RESTART: /Users/Dustin/OneDrive/School Work/Work Study/pjlink_test.py === 

Traceback (most recent call last): 
    File "/Users/Dustin/OneDrive/School Work/Work Study/pjlink_test.py", line 4, in <module> 
    power = projector.get('%POW') 
    File "/Library/Python/2.7/site-packages/pypjlink/projector.py", line 119, in get 
    success, response = protocol.send_command(self.f, body, '?') 
    File "/Library/Python/2.7/site-packages/pypjlink/protocol.py", line 71, in send_command 
    resp_body, resp_param = parse_response(f) 
    File "/Library/Python/2.7/site-packages/pypjlink/protocol.py", line 30, in parse_response 
    assert header == '%' 
AssertionError 
>>> -m unittest discover pypjlink.tests 
SyntaxError: invalid syntax 
>>> unittest discover pypjlink.tests 
SyntaxError: invalid syntax 
>>> discover pypjlink.tests 
SyntaxError: invalid syntax 
>>> 
=== RESTART: /Users/Dustin/OneDrive/School Work/Work Study/pjlink_test.py === 

Traceback (most recent call last): 
    File "/Users/Dustin/OneDrive/School Work/Work Study/pjlink_test.py", line 4, in <module> 
    power = projector.get('%POW') 
    File "/Library/Python/2.7/site-packages/pypjlink/projector.py", line 119, in get 
    success, response = protocol.send_command(self.f, body, '?') 
    File "/Library/Python/2.7/site-packages/pypjlink/protocol.py", line 71, in send_command 
    resp_body, resp_param = parse_response(f) 
    File "/Library/Python/2.7/site-packages/pypjlink/protocol.py", line 30, in parse_response 
    assert header == '%' 
AssertionError 
>>> 
=== RESTART: /Users/Dustin/OneDrive/School Work/Work Study/pjlink_test.py === 

Traceback (most recent call last): 
    File "/Users/Dustin/OneDrive/School Work/Work Study/pjlink_test.py", line 4, in <module> 
    power = projector.get('POW') 
    File "/Library/Python/2.7/site-packages/pypjlink/projector.py", line 119, in get 
    success, response = protocol.send_command(self.f, body, '?') 
    File "/Library/Python/2.7/site-packages/pypjlink/protocol.py", line 67, in send_command 
    data = to_binary(req_body, req_param) 
    File "/Library/Python/2.7/site-packages/pypjlink/protocol.py", line 20, in to_binary 
    assert len(body) == 4 
AssertionError 
>>> 
=== RESTART: /Users/Dustin/OneDrive/School Work/Work Study/pjlink_test.py === 

Traceback (most recent call last): 
    File "/Users/Dustin/OneDrive/School Work/Work Study/pjlink_test.py", line 4, in <module> 
    power = projector.get('POWR') 
    File "/Library/Python/2.7/site-packages/pypjlink/projector.py", line 119, in get 
    success, response = protocol.send_command(self.f, body, '?') 
    File "/Library/Python/2.7/site-packages/pypjlink/protocol.py", line 71, in send_command 
    resp_body, resp_param = parse_response(f) 
    File "/Library/Python/2.7/site-packages/pypjlink/protocol.py", line 30, in parse_response 
    assert header == '%' 
AssertionError 
>>> 

Quelques informations supplémentaires: Je connecte le projecteur sur un réseau avec une adresse IP statique C'est un projecteur BenQ, et j'ai une liste de commande pjlink. Si j'essaie d'envoyer une commande, cela fonctionnera, mais j'ai toujours cette erreur. Le programme a juste du mal à recevoir des réponses.

Répondre

0

essayer d'appeler projector.authenticate('some_auth') après avoir créé l'objet du projecteur (il suffit d'utiliser un nom fictif si vous n'avez pas auth.) je aussi utiliser get_power() plutôt get('POWR') mais vous pourriez avoir des raisons.