SSL 480 error in python Requests - android

I have scripts relying on the python "Requests" library. Two different scripts relying on the same lib all throw the same error (Tweepy crashes because of it, as does a simple HTTP GET):
xtras/python/requests/api.py", line 44, in request return
session.request(method=method, url=url, **kwargs)
File
"/mnt/sdcard/com.googlecode.pythonforandroid/extras/python/requests/sessions.py",
line 461, in request
resp = self.send(prep, **send_kwargs) File
"/mnt/sdcard/com.googlecode.pythonforandroid/extras/python/requests/sessions.py",
line 567, in send r = adapter.send(request, **kwargs)
File
"/mnt/sdcard/com.googlecode.pythonforandroid/extras/python/requests/adapters.py",
line 400, in send raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 1] _ssl.c:480:
error:0D0C50A1:asn1 encoding routines:ASN1_item_verify:unknown message
digest algorithm
This has only started happening recently (it worked fine before). The script is running on an Android phone using SL4A.

I had the exact same issue. As far as I can tell, this problem is caused by the version/build of Python installed on your phone. I assume you are using the Python 2 apk from the Py4a project.
To solve the problem, you can install the Python 3 apk which seems to better support SSL, but if you do so, you will need to port your scripts from Python 2 to Python 3.

Related

Automation testing error while starting Test Cases

What is causing this error when I run my Android app's automated testing?
C:\Users\sujan\PycharmProjects\code\auto_env\OTT_Client
Traceback (most recent call last):
File "src/Utilities_test/Convert_csvToPy.py", line 13, in <module>
from template.cases_template import test_case_dict
ImportError: bad magic number in 'template': b'\x03\xf3\r\n'
command 'python src/Utilities_test/Convert_csvToPy.py Test_cases.csv' return with error (code 1): b''
This error probably is a result of a mix between 2.7 & 3+ versions, also happens if you have manually named your file with an extension .pyc
the error isn't actually coming from your test cases. The magic number comes from UNIX-type systems where the first few bytes of a file held a marker indicating the file type. Python puts a similar marker into its pyc files when it creates them.
Then the python interpreter makes sure this number is correct when loading it.
Anything that corrupts this magic number will cause your problem, like if you edit a pyc file or your trying to run from a different version of python
as for fixing it you could try a few things. You could try to do a clean on the pyc files something like
find . -name "*.pyc" -exec rm -f {} \;
The command above will delete all pyc files recursively. then just run again and it should recompile
or if you cloned something from a repo just delete and and reclone

Can't build jxcore for android

I wanted to build the JXcore libraries for android, and i have encountered an error.
I have met all the Prerequisites:
I'm running ubuntu 16.04, with gcc 5.4.0, python 2.7.12,GNU Make 4.1.
This are the steps i have followed:
I have downloaded android ndk, and extracted it in ~/Downloads/android-ndk-r12b
cloned the jxcore library in ~/Downloads/jxcore
cd into jxcore
ran build_scripts/android-configure.sh ../android-ndk-r12b/, this script finished successfully
Then i needed to run build_scripts/android_compile.sh ../android-ndk-r12b/ --embed-leveldown
And i hit an error in the last step, this is the log:
Compiling Android ARM7
Traceback (most recent call last):
File "./configure", line 1119, in <module>
configure_node(output)
File "./configure", line 645, in configure_node
configure_arm(o)
File "./configure", line 569, in configure_arm
elif is_arm_hard_float_abi():
File "./configure", line 491, in is_arm_hard_float_abi
if compiler_version() >= (4, 6, 0):
File "./configure", line 560, in compiler_version
version = tuple(map(int, proc.communicate()[0].split('.')))
ValueError: invalid literal for int() with base 10: 'x\n'
compilation aborted for arm target
Does anyone know what causes this, or a fix for it ?
I ran into the same problem. I did a quick and dirty fix just to get going.
Open the "configure" file in your jxcore folder. Go to line number 560 as in the last entry in your log. Comment out line 560 with the # in front.
Insert a changed version of that line underneath as shown below:
line 560: #version = tuple(map(int, proc.communicate()[0].split('.')))
line 561: version = tuple(map(int, "4.9.0".split('.')))
... basically what happens is that your version of CC goes something like "4.9.x" and as Python fails to convert the "x" to an integer the process stops. I just replaced the "x" with a "0". However you might want to check your version just to be safe. Therefore place print proc.communicate()[0] right before line 560 before you make the other changes. Then your actual version number will be printed out in your log, when you run the program again.
I hope that may help you.

Android Asynchronous Http Client - Can't install on Mac OS 10.10.5

I just downloaded the main Java Jar file directly from here: http://loopj.com/android-async-http/
Double-clicked the jar file and got this error message pop up:
"The Java JAR file "android-async-http-1.4.9.jar" could not be launched.
Check the Console for possible error messages."
In the console, it had the following 4 messages pop up:
4/23/16 7:34:40.805 AM com.apple.xpc.launchd[1]: (com.apple.xpc.launchd.domain.pid.quicklookd.2848) Path not allowed in target domain: type = pid, path = /Library/Frameworks/iTunesLibrary.framework/Versions/A/XPCServices/com.apple.iTunesLibraryService.xpc error = 147: The specified service did not ship in the requestor's bundle, origin = /System/Library/Frameworks/QuickLook.framework/Versions/A/Resources/quicklookd.app
4/23/16 7:34:53.261 AM QuickLookSatellite[2861]: [QL] Using too much memory (127 MB), hit critical threshold (120 MB), exiting immediately to clean up.
4/23/16 7:34:53.280 AM com.apple.xpc.launchd[1]: (com.apple.quicklook.satellite.2CBCE90F-159F-4B12-83D8-1859B1F39063[2861]) Service exited due to signal: Killed: 9
4/23/16 7:34:53.597 AM QuickLookSatellite[2879]: ImageIO: JPEG Corrupt JPEG data: 1502 extraneous bytes before marker 0xfe
4/23/16 7:34:53.600 AM QuickLookSatellite[2879]: ImageIO: JPEG JPEG datastream contains no image
For reference, I've confirmed that in my mac security, I've switched it to "allow apps downloaded from anywhere," so that shouldn't be an issue.
In addition, I suspect the last two are related to the actual image of the pop-up error (the first thing I reported)... so once the root cause is resolved, there shouldn't be a need for an error message and everything should be dandy.
How can I resolve this?
This jar file is Android library, it is not application file ==> You can not run this file.

ValueError: can't find recovery API version in input target-files

I am trying to create a patch for different AOSP versions upgrading, without changing the APKs located in app or priv-app folders, which means the APPs version should hold still in the original versions.
I’ve checked the OTA Package Tools out on AOSP website:
Right now, I have the AOSP source code in Ubuntu 12.04 and trying to implement the "incremental updates" with command shown as the website.
However, a ValueError message appears after I do that as the following:
unzipping target target-files...
Traceback (most recent call last):
File "./build/tools/releasetools/ota_from_target_files", line 1119, in <module>
main(sys.argv[1:])
File "./build/tools/releasetools/ota_from_target_files", line 1062, in main
OPTIONS.info_dict = common.LoadInfoDict(input_zip)
File "~/openlinux_kk-amlogic/build/tools/releasetools/common.py", line 120, in LoadInfoDict
raise ValueError("can't find recovery API version in input target-files")
ValueError: can't find recovery API version in input target-files
Could anybody do me a favor to provide some methods possibly solve this problem?
The problem I have successfully gotten the answer, I have to make my patch file with the zip file target_files.zip, not the general zip file, then the python is able to create the patch file.
However, I still have a problem that after I finish creating the patch file, and trying to flash it via adb sideload command,
After finish flashing this procedure, the result after I flashing the zip didn’t work, and a message shown as the following:
system/bin/filename” has unexpected contents
That filename stands for the file I tuned it in the patch file, as the figure shown:
If my method is wrong, does anybody know how to apply the patch I created with sideload flashing?
Thank you in advanced.

Qpython uknown RPC error

I installed the QPython app on Android and executed a script name helloworld.py. It used androidhelper's method maketoast to show a message with the Android api.
I tried writing the exact same script on another file but it is giving me the following error:
com.googlecode.android_scripting.rpc.RpcError: Unknown RPC.
Then I tried to modify helloworld.py and it's now giving me the above error.
I searched all over the internet for this error but no solutions.
By the way, I use a rooted Samsung Galaxy Tab 3 LITE T110N.
I already tried using the android module, but it doesn't exist. So does sl4a doesn't exist.
I use python 2.7.
import androidhelper
droid=androidhelper.Android()
droid.makeToast("Hello, sl4a!")
#not maketoast
#it's makeToast!
#read this:
#http://www.mithril.com.au/android/doc/index.html
#when you call sl4a,you have to tell sl4a what to do, if sl4a can't recognize it,
#sl4a throws an Unknown RPC error
#Thanks

Categories

Resources