Python error trying to convert JaCoCo to Cobertura - python

I am trying to convert a JaCoCo coverage report to Cobertura format (since Shippable only supports Cobertura). This guy claims to have a tool to convert JaCoCo to Cobertura, however when running his script I get the following error:
Traceback (most recent call last):
File "cover2cover.py", line 151, in <module>
jacoco2cobertura(filename, source_root)
File "cover2cover.py", line 139, in jacoco2cobertura
convert_root(root, into, source_root)
File "cover2cover.py", line 127, in convert_root
packages.append(convert_package(package))
File "cover2cover.py", line 113, in convert_package
c_classes.append(convert_class(j_class, j_package))
File "cover2cover.py", line 100, in convert_class
c_methods.append(convert_method(j_method, j_method_lines))
File "cover2cover.py", line 85, in convert_method
convert_lines(j_lines, c_method)
File "cover2cover.py", line 33, in convert_lines
for jline in j_lines:
File "cover2cover.py", line 23, in method_lines
larger = list(int(jm.attrib['line']) for jm in jmethods if int(jm.attrib['line']) > start_line)
File "cover2cover.py", line 23, in <genexpr>
larger = list(int(jm.attrib['line']) for jm in jmethods if int(jm.attrib['line']) > start_line)
KeyError: 'line'
I know nothing about python, so any help would be appreciated.

I don't know python either, but I know that python 2 and python 3 have significant differences. Perhaps you ran into that?
I was able to run the script ok with this version:
$> python --version
Python 2.7.11
To ensure I got the script without any download or browser or line-ending type issues, I did clone the git repo:
$> git clone https://github.com/rix0rrr/cover2cover.git
Then the script ran first try on my jacoco XML file.

Related

Using mysql connector with pyinstaller --onefile causes issue at runtime

I am trying to use pyinstaller to create a .exe for someone else to run. The program uses mysql to ping a sql database and return information from it. When I run the program in PyCharm and with pyinstaller --onedir, everything works fine. However, when I bundle the program with --onefile, I get this error and traceback when running:
Traceback (most recent call last):
File "main.py", line 266, in <module>
File "main.py", line 88, in main
File "main.py", line 108, in grabData
File "sql.py", line 12, in SQLconnect
File "mysql\connector\pooling.py", line 286, in connect
File "mysql\connector\connection_cext.py", line 101, in __init__
File "mysql\connector\abstracts.py", line 1095, in connect
File "mysql\connector\connection_cext.py", line 199, in _open_connection
TypeError: argument 6 must be str, not None
For reference, here is the relevant line in the _open_connection function call in connection_cext.py:
self._cmysql = _mysql_connector.MySQL(
buffered=self._buffered,
raw=self._raw,
charset_name=charset_name,
connection_timeout=(self._connection_timeout or 0),
use_unicode=self._use_unicode,
auth_plugin=self._auth_plugin,
plugin_dir=self._plugin_dir,
)
The __init__ of this file has this code snippet:
self._plugin_dir = os.path.join(
os.path.dirname(os.path.abspath(_mysql_connector.__file__)),
"mysql",
"vendor",
"plugin",
)
I believe this plugin directory is the reason my code is failing, but I do not know how to bypass this or set it so that it references the right file at runtime. I know pyinstaller creates a temp file at runtime, but I don't know how to get the module to use it as the plugin directory.
Any help would be greatly appreciated! I really really wanna keep it in --onefile mode for simplicity for the user, so any solutions that maintain that would be ideal. Thanks!

Unable to build V8 in Windows 10

I'm using this link as reference (https://medium.com/angular-in-depth/how-to-build-v8-on-windows-and-not-go-mad-6347c69aacd4) to build v8 but i think its out of date or i'm doing something wrong.
I can't run this (ninja -C out.gn/x64.release) command because its showing this error constantly
ninja: error: loading 'build.ninja': The system cannot find the file specified.
ninja: Entering directory `out.gn\foo
also im getting this error too
D:\v8_dev\v8Engine\v8>gn args out.gn\foo
Waiting for editor on "D:\v8_dev\v8Engine\v8\out.gn\foo\args.gn"...
Generating files...
Traceback (most recent call last):
File "D:/v8_dev/v8Engine/v8/build/vs_toolchain.py", line 561, in <module>
sys.exit(main())
File "D:/v8_dev/v8Engine/v8/build/vs_toolchain.py", line 557, in main
return commands[sys.argv[1]](*sys.argv[2:])
File "D:/v8_dev/v8Engine/v8/build/vs_toolchain.py", line 371, in CopyDlls
_CopyRuntime(target_dir, runtime_dir, target_cpu, debug=False)
File "D:/v8_dev/v8Engine/v8/build/vs_toolchain.py", line 346, in _CopyRuntime
suffix)
File "D:/v8_dev/v8Engine/v8/build/vs_toolchain.py", line 284, in _CopyUCRTRuntime
assert len(ucrt_files) > 0
AssertionError
ERROR at //build/toolchain/win/BUILD.gn:49:3: Script returned non-zero exit code.
exec_script("../../vs_toolchain.py",
^----------
Current dir: D:/v8_dev/v8Engine/v8/out.gn/foo/
Command: D:/v8_dev/depot_tools/bootstrap-3_8_0_chromium_8_bin/python/bin/python.exe D:/v8_dev/v8Engine/v8/build/vs_toolchain.py copy_dlls D:/v8_dev/v8Engine/v8/out.gn/foo Release x64
Returned 1.
See //BUILD.gn:905:1: which caused the file to be included.
action("postmortem-metadata") {
^------------------------------
Ultimately i want it to work like as its shown in the embedded picture
if you are looking for the solution then follow this link (https://github.com/pmed/v8-nuget) for visual studio users, its working really well without all the hassle.

Python:Pycall Validation Error while Calling

I have Asterisk 13.20 set up and running fine on Ubuntu 16.04,calls are going well through a Softphone(Zoiper), I came across a Library in Python "Pycall" which lets you make calls through a Python Script.So I tried testing a snippet from the site Pycall
The code that I used:
from pycall import CallFile, Call, Application
call = Call('SIP/flowroute/18882223333')
action = Application('Playback', 'hello-world')
c = CallFile(call, action)
c.spool()
Just made changes in the extension,wherein I used one from my server
However I am getting the following error:
Traceback (most recent call last):
File "test.py", line 10, in <module>
c.spool()
File "/usr/local/lib/python2.7/dist-packages/pycall/callfile.py", line 131, in spool
self.writefile()
File "/usr/local/lib/python2.7/dist-packages/pycall/callfile.py", line 119, in writefile
f.write(self.contents)
File "/usr/local/lib/python2.7/dist-packages/pycall/callfile.py", line 114, in contents
return '\n'.join(self.buildfile())
File "/usr/local/lib/python2.7/dist-packages/pycall/callfile.py", line 96, in buildfile
raise ValidationError
pycall.errors.ValidationError
Tried searching online for the solution but coudnt find one,What am I doing wrong?
This question not related to PBX, it is just incorrect use of LIB.
General instruction how to solve ANY issue with availible source code.
You have error
File "/usr/local/lib/python2.7/dist-packages/pycall/callfile.py", line 96, in buildfile
Go that file and line, check code, add more debug if needed, fix your app.
Run as asterisk user.
sudo su asterisk -s /bin/bash
python
from pycall import CallFile, Call, Application
call = Call('SIP/flowroute/18882223333')
action = Application('Playback', 'hello-world')
c = CallFile(call, action)
c.spool()

Mac: Opening large files creates `invalid argument` error

I am currently trying to open a large file on my 64 bit Mac (using 64 bit Miniconda, as this is the only version for mac). I use a framework 'sumatra' which is a library to track scientific computing work and possibly reproduce it. I get the following error. I was able to debug a little, and found out that it is mainly due to X_train.npy being too big (3.6GB when not unpacked).
Traceback (most recent call last):
File "/Users/davidal/miniconda3/envs/ml_project/bin/smt", line 31, in <module>
main(sys.argv[2:])
File "/Users/davidal/miniconda3/envs/ml_project/lib/python3.5/site-packages/sumatra/commands.py", line 372, in run
project.allow_command_line_parameters)
File "/Users/davidal/miniconda3/envs/ml_project/lib/python3.5/site-packages/sumatra/commands.py", line 76, in parse_arguments
parameters = build_parameters(arg)
File "/Users/davidal/miniconda3/envs/ml_project/lib/python3.5/site-packages/sumatra/parameters.py", line 586, in build_parameters
parameters = parameter_set_class(filename)
File "/Users/davidal/miniconda3/envs/ml_project/lib/python3.5/site-packages/parameters/__init__.py", line 387, in __init__
pstr = f.read()
OSError: [Errno 22] Invalid argument
Any experience resolving such issues? Where should I look further? Any ideas?

Uncompyle2 issue: array indices must be integers

I have an issue when I am trying to decompile a .pyc file.
The traceback is the following:
Traceback (most recent call last):
File "my.py", line 4, in <module>
uncompyle2.uncompyle_file("/home/user/Downloads/asd.pyc", fileobj)
File "/home/user/Desktop/uncompyle2/uncompyle2/__init__.py", line 130, in uncompyle_file
uncompyle(version, co, outstream, showasm, showast, deob)
File "/home/user/Desktop/uncompyle2/uncompyle2/__init__.py", line 93, in uncompyle
tokens, customize = scanner.disassemble(co, deob=deob)
File "/home/user/Desktop/uncompyle2/uncompyle2/Scanner.py", line 214, in disassemble
cf = self.find_jump_targets(code)
File "/home/user/Desktop/uncompyle2/uncompyle2/Scanner.py", line 926, in find_jump_targets
self.detect_structure(i, op)
File "/home/user/Desktop/uncompyle2/uncompyle2/Scanner.py", line 737, in detect_structure
if int(self.code[jmp]) == RETURN_VALUE:
**TypeError: array indices must be integers**
Any ideas about this ?
I'm using Python 2.7.6 on a Ubuntu machine.
The command that I'm running to have this work is the following:
uncompyle2 asd.pyc
//EDIT: As far as I can tell, this happens only on a specific file(asd.py). It works on other files.
Any workaround ?
The .pyc file that you're trying to decompile is probably obfuscated. It's not uncompyle2s job to also deofuscate the file.
Try something else like pyc2py. Maybe it will work.

Categories