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
Related
I'm trying to run valgrind on an android OS but it couldn't start and it shows this errors that i couldn't find how to solve:
valgrind: Startup or configuration error:
Can't create client cmdline file in /tmp/valgrind_proc_87_cmdline_876a7612
valgrind: Unable to start up properly. Giving up.
Thanks in advance !
I tried to change the default path that valgrind use and which is shown on the error log but i couldn't make it
The problem is happening in the code where the Valgrind host is creating a fake /proc/<pid>/cmdline.
This file should be created in the location given by the first valid item in the following list:
The TMPDIR environment variable
The constant VG_TMPDIR that gets baked into the binary via a configure time option. This defaults to /tmp but can be overriden using configure --with-tmpdir=/your/tmp/dir. That would require that you get the Valgrind source and configure and build it. It is possible that you are using a package that was built using this option and is not compatible with your system.
Last resort, "/tmp"
All of the above checks just test that the string is non-null and not empty. They do not test for the existance and accessibility of the directory. That gets determined by the Valgrind version of mkstemp and the error message comes from 'valgrind_main'.
Valgrind needs to create a file TMPDIR/valgrind_proc_PID_cmdline_RAND where TMPDIR is described above, PID is the pid of the Valgrind process and RAND is a random number.
There is at least one other similar files that get created, for auxv.
There are no Valgrind command line options to turn off the creation of these files.
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.
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.
few days ago I got into Android app creating. I learned about Kivy. It simplicity overwhelmed so I decided to stick to it and try to design some App. The Dev team provides Buildozer to build the App for Android easily - but I have not been able to do this step.
In the process of creating the App for Android I get two errors, since I don't know whether they relate I'll present both of them.
First error
When I run my application on Linux (Ubuntu) I got an Error, although the App works and it looks like there is no problem. The error log:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 808, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 761, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/lib/python2.7/dist-packages/kivy/input/providers/mtdev.py", line 193, in _thread_run
_device = Device(_fn)
File "/usr/lib/python2.7/dist-packages/kivy/lib/mtdev.py", line 131, in __init__
self._fd = os.open(filename, os.O_NONBLOCK | os.O_RDONLY)
OSError: [Errno 13] Permission denied: '/dev/input/event7'
Second Error
I'have installed buildozer using sudo pip install buildozer. When I try to use buildozer init I got following error:
Traceback (most recent call last):
File "/usr/local/bin/buildozer", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2825, in <module>
add_activation_listener(lambda dist: dist.activate())
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 710, in subscribe
callback(dist)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2825, in <lambda>
add_activation_listener(lambda dist: dist.activate())
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2257, in activate
self.insert_on(path)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2364, in insert_on
self.check_version_conflict()
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2403, in check_version_conflict
for modname in self._get_metadata('top_level.txt'):
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2251, in _get_metadata
for line in self.get_metadata_lines(name):
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1219, in get_metadata_lines
return yield_lines(self.get_metadata(name))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1211, in get_metadata
return self._get(self._fn(self.egg_info,name))
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1326, in _get
stream = open(path, 'rb')
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/google_api_python_client-1.2-py2.7.egg/EGG-INFO/top_level.txt'
This error prevents the process from going on and buildozer init fails to create buildozer.spec.
More information
In fact I have tried to run both the app, lets say sudo main.py and sudo buildozer init. At first it seemed to solve the issue, but the first time I ran buildozer android debug deploy run it took forever and unfortunately I had to kill it.
The second time I wanted to do it properly, and it was strange to me that in the example they do not use sudo. Also I have found everywhere NEVER run buildozer with sudo. So, I unistalled both kivy and buildozer, and installed it again, restart my pc. But nothing changed. Maybe my stupid app has some issues (that might solve the first error), but probably not the second one. Any help appreciated - also I can give more information.
Note
I've looked on other questions, but they seemed to solve different issues.
First Error: not an issue. Your user doesn't have access to directly read the input device - but usually that's because it's a laptop touchpad which Kivy doesn't need to read anyway (it uses it as a mouse, not a touch input device). You can safely ignore that one - if it really bothers you, you can modify udev rules to give your user access to those devices.
Second Error: apparently due to an issue with the Google API package. Uninstalling that package fixes buildozer. You might be able to reinstall it now (maybe the Google package didn't install properly, which confused pkg_resources when it was scanning things?). If not, you could try installing that package in a virtualenv to separate it from other packages.
I have been trying to build an android kernel for a certain device, the Huawei Vitria, they finally uploaded their kernel source about 2 months ago so I try to build it the normal way which fails so I fix the main errors I see and get the kernel to build finally but, then I notice one error while building. I look into this file and see that they are using a weird way of building I think instead of the normal defconfigs, using a generic defconfig then a configuration file to configure their devices ontop of that(they've done this before but not to this extent), which leads me to think I'm missing a command to select the device config ontop of the defconfig to set up the drivers, but don't know what command was used.
So might there be a way to find out the command by looking at these two files
https://raw.githubusercontent.com/KainXS/android_kernel_huawei_y301a2/jellybean/drivers/huawei/hsad/parse_product.pl
https://raw.githubusercontent.com/KainXS/android_kernel_huawei_y301a2/jellybean/drivers/huawei/hsad/parse_product_id.pl
thanks
I'm not sure how much help this is, but the first command seems to want to be called with a parameter of a path to an XML file.
./parse_product.pl /ab/cd/hw_xxy_configs.xml
PRODUCT: xxy
reads: '/ab/cd/hw_xxy_configs.xml'
It pulls out some data from that file and pastes it into a .c file which presumably goes into the build configuration.
So, you're looking for an XML file containing your product-name.
The second file calls the first repeatedly to generate a set of .c files. Now - this second script takes an XML file as an argument, but I'm afraid I can't tell what it might be called. The file looks like it should contain product names and board-ids if that is any help.