I'd like to be able to access serial port from within monkeyrunner script. I've got separate python script that talks via rs232 to a device, and I've got a monkeyrunner script that drives an Android smartphone.
Now. After implementing the python script inside my monkeyrunner script and adding a specific path to the python serial module, the script reutrns the following error msg:
121219 10:40:51.630:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] Script terminated due to an exception
121219 10:40:51.630:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]Traceback (most recent call last):
File "C:\Android\android-sdk\tools\serial_test.py", line 13, in <module>
import serial
File "c:\Python27\Lib\site-packages\serial\__init__.py", line 23, in <module>
from serialjava import *
File "c:\Python27\Lib\site-packages\serial\serialjava.py", line 35, in <module>
comm = detect_java_comm([
File "c:\Python27\Lib\site-packages\serial\serialjava.py", line 29, in detect_java_comm
raise ImportError("No Java Communications API implementation found")
ImportError: No Java Communications API implementation found
serial_test.py:
import sys
sys.path.append("c:\\Python27\\Lib\\site-packages")
import serial
Google pointed to a number of websites :
From: Java Comm API Package download
through : http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-misc-419423.html
to: http://mho.republika.pl/java/comm/
I've dowlnoaded and installed JavaComm from http://code.google.com/p/smslib/downloads/list
I also tried http://rxtx.qbang.org/wiki/index.php/Using_RXTX
But none of the sites actually had library that simply worked. Unless I messed up the installation but I find it hard to believe as it's just a matter of copying the files (apparently). From what I understand the Java Comms API package is now obsolete and not supported any more. There is contradicting info on the official Oracle FAQ. You can download java_comm_api-30u1-linux.zip and inside you'll find readme saying "We do not provide a linux implementation.
So here's the question: how can I use serial port inside monkeyrunner script ? Where can I find a simple example of using serial port in monkeyrunner/jython ?
Related
For the Form recognizer sample code provided in the below link, the Python interpreter cannot recognize Azure core API’s.
link
python —version
-Python 3.9.1
pip3 —version
- ip 21.0 from /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip (python 3.9)
I receive the following error:
Exception has occurred: ModuleNotFoundError
No module named 'azure'
File "/Users/visiothoughts/Documents/Visiothoughts/Work-Project/AI-Moto/com/ai/Bill-Recogniser/RecogniseFormContent.py", line 5, in <module>
from azure.core.exceptions import ResourceNotFoundError
Can I get some guidance on what is missing?
Looks like the module for Azure-Core has not been installed.
Run
pip install azure-core
Since the error you re receiving is below :
from azure.core.exceptions import ResourceNotFoundError
I recently installed Micropython on my Raspberry Pi model 3. I followed all the steps mentioned in the Raspberry pi - how to guide. https://www.raspberrypi.org/forums/viewtopic.php?t=191744
But, when I try to import the network module, it throws a 'module not found' error. I have searched a lot for the solution to my problem, but haven't found a solution yet.
I searched for the micropython-network module but it is not available on https://pypi.org/search/?q=micropython+network
The closest ones are micropython-cpython-network and network. I tried using the network module but it doesn't contain the functions that I require (e.g.: WLAN).
Also, I have used Micropython on the ESP32. It works fine. No errors.
I think this is something Raspberry Pi-specific.
When I write this:
import network
The error message shows:
Traceback (most recent call last):
File "<stdin>" ,line 1, in <module>
ImportError: no module named 'network'
Sorry im a total noob with this. So ive tried integrating Sikuli in my Working RF setup meaning, I have to move from Python to Jython for this to work. my problem now is that im always getting an error.
Error in file 'C:\robot\suites\Test\Test.robot':
Importing test library 'Selenium2Library' failed: ImportError: No module named decorator
Traceback (most recent call last):
File "C:\jython2.7.0\Lib\site-packages\Selenium2Library\__init__.py", line 2, in <module>
from keywords import *
File "C:\jython2.7.0\Lib\site-packages\Selenium2Library\keywords\__init__.py", line 1, in <module>
from _logging import _LoggingKeywords
File "C:\jython2.7.0\Lib\site-packages\Selenium2Library\keywords\_logging.py", line 4, in <module>
from keywordgroup import KeywordGroup
File "C:\jython2.7.0\Lib\site-packages\Selenium2Library\keywords\keywordgroup.py", line 4, in <module>
from decorator import decorator
File "C:\jython2.7.0\Lib\site-packages\Selenium2Library\keywords\keywordgroup.py", line 4, in <module>
from decorator import decorator
PYTHONPATH:
C:\jython2.7.0\bin\jythonsikuli.bat
C:\jython2.7.0\Lib
__classpath__
__pyclasspath__/
C:\jython2.7.0\Lib\site-packages
CLASSPATH:
C:\jython2.7.0\jython.jar
C:\Sikuli\sikulix.jar
20180308 11:23:08.246 ERROR Error in file 'C:\robot\suites\Test\Test.robot':
Getting keyword names from library 'Remote' failed: Calling dynamic method
'get_keyword_names' failed: Connecting remote server at http://localhost:8270 failed:
[Errno 10061] Connection refused
In your error message there are two issues clearly defined:
Importing test library 'Selenium2Library' failed: ImportError: No module named decorator
Which can be solved by installing the relevant Python Module from PIP:
pip install decorator
The second issue is towards the end:
Connecting remote server at http://localhost:8270 failed:
[Errno 10061] Connection refused
This means that Robot Framework is unable to make a connection on port 8720. This is often due to:
Firewalls preventing an opened port to be accessible. In Windows add a FireWall rule allowing for port 8270 to be accessible from the outside.
Try and connect using http://127.0.0.1:8270. Although often a synonym for localhost at a technical level it is not the same.
I am a team member of research group and my current research needs to use Openstack Swift.
We have installed Openstack Juno and it works perfectly. For installation Packstack have used used. The swift service is also installed on the server and it works! We have tried to access it from the console create container, upload a file etc. everything works.
So we went further and tried to access swift using its API. Here we faced a problem on the phase of authentication.
Below you can see the simple python code I am using to check if I can connect to Swift.
import swiftclient
import keystoneclient
conn = swiftclient.Connection(
authurl='http://*[server ip]*:5000/v2.0/',
user='account_name:username',
key='serverpassword',
auth_version="2.0").get_auth()[0]
for container in conn.get_account()[1]:
print container['name']
Before executing the cod on client computer, I have installed the following necessary packages.
sudo aptitude install python-pip
sudo pip install python-swiftclient
sudo pip install python-keystoneclient
Here you can see the error which occurs during execution of the code.
Traceback (most recent call last):
File "new.py", line 15, in <module>
auth_version="2.0").get_auth()[0]
File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 1332, in get_auth
timeout=self.timeout)
File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 463, in get_auth
auth_version=auth_version)
File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 366, in get_auth_keystone
ksclient, exceptions = _import_keystone_client(auth_version)
File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 351, in _import_keystone_client
variables to be set or overridden with -A, -U, or -K.''')
swiftclient.exceptions.ClientException:
Auth versions 2.0 and 3 require python-keystoneclient, install it or use Auth
version 1.0 which requires ST_AUTH, ST_USER, and ST_KEY environment
variables to be set or overridden with -A, -U, or -K.
I have tried to find the solution searching in the Internet but I have not succeed.
I am trying to launch the hello world sample,I use TideSDK 1.3.1-beta with Tide SDK Developer,I have install all the needed components such as imagick,wix and python 2.7 ,But I am getting this error during launch :
Preparing to package and launch desktop app. One moment...
C:\Python27\\lib\site.py:158: Warning: 'with' will become a reserved keyword in Python 2.6
'import site' failed; use -v for traceback
C:\Python27\\lib\linecache.py:127: Warning: 'with' will become a reserved keyword in Python 2.6
C:\Python27\\lib\linecache.py:127: Warning: 'with' will become a reserved keyword in Python 2.6
Traceback (most recent call last):
File "C:\ProgramData\TideSDK\sdk\win32\1.3.1-beta\tidebuilder.py", line 36, in
import env
File "C:\ProgramData\TideSDK\sdk\win32\1.3.1-beta\env.py", line 32, in
import app
File "C:\ProgramData\TideSDK\sdk\win32\1.3.1-beta\app.py", line 34, in
import os, os.path as p
File "C:\Python27\\lib\os.py", line 63, in
import ntpath as path
File "C:\Python27\\lib\ntpath.py", line 12, in
import warnings
File "C:\Python27\\lib\warnings.py", line 6, in
import linecache
File "C:\Python27\\lib\linecache.py", line 127
with open(fullname, 'rU') as fp:
^
SyntaxError: invalid syntax
Done launching!
I have fixed the problem , Since TideSDK comes with its own Python runtime,I created an environmental variable pointing to that python runtime so this was how I did it . [code] variable home : PYTHONHOME variable vaulue : C:\ProgramData\TideSDK\modules\win32\python\1.3.1-beta
It almost seems like it's using a different Python version, although the folder clearly says 2.7. Did you have another version of Python installed before? If so, did you change the environment variable to point to 2.7 after installing 2.7? Maybe confirm with python --version.