So, I`m comparing some python test frameworks and came across behave. Thought it was interesting and worth a test drive.
Followed the steps on the tutorial, available at:
https://behave.readthedocs.io/en/stable/tutorial.html
When I ran the behave command on Powershell (Win10 and Python 2.7.10), I got the following error:
Exception TypeError: compile() expected string without null bytes
Traceback (most recent call last):
File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\lib\site-packages\behave\__main__.py", line 187, in <module>
sys.exit(main())
File "C:\Python27\lib\site-packages\behave\__main__.py", line 183, in main
return run_behave(config)
File "C:\Python27\lib\site-packages\behave\__main__.py", line 127, in run_behave
failed = runner.run()
File "C:\Python27\lib\site-packages\behave\runner.py", line 804, in run
return self.run_with_paths()
File "C:\Python27\lib\site-packages\behave\runner.py", line 809, in run_with_paths
self.load_step_definitions()
File "C:\Python27\lib\site-packages\behave\runner.py", line 796, in load_step_definitions
load_step_modules(step_paths)
File "C:\Python27\lib\site-packages\behave\runner_util.py", line 412, in load_step_modules
exec_file(os.path.join(path, name), step_module_globals)
File "C:\Python27\lib\site-packages\behave\runner_util.py", line 385, in exec_file
code = compile(f.read(), filename2, "exec", dont_inherit=True)
TypeError: compile() expected string without null bytes
Has anyone encountered this error while trying to run behave? (Found some threads online related mainly to flask issues but I couldn't solve the problem)
Answering my own question here.
It was an encoding problem.
Sublime was saving my files with an encoding different from UTF-8.
File -> Save with Encoding -> UTF-8 did the trick.
Related
Has anyone tried tried to run MassWappalyzer?
From GitHub: **https://github.com/tristanlatr/MassWappalyzer
**
Hi,
I am trying to run MassWappalyzer on my terminal. i have already installed everything and got my MassWappalyzer folder installed, with the script, samples, etc.
However, when I try running the command python3 -m masswappalyzer -i websites.txt -o websites.xlsx
It states this:
Mass Wappalyzer
Using python-Wappalyzer
Traceback (most recent call last):
File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "/Users/andreualegre/MassWappalyzer/masswappalyzer.py", line 408, in
main()
File "/Users/andreualegre/MassWappalyzer/masswappalyzer.py", line 401, in main
mass_w = MassWappalyzer(urls, **args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/andreualegre/MassWappalyzer/masswappalyzer.py", line 281, in init
self.analyzer = WappalyzerWrapper(
^^^^^^^^^^^^^^^^^^
File "/Users/andreualegre/MassWappalyzer/masswappalyzer.py", line 247, in init
self._analyze = PythonWappalyzer().analyze
^^^^^^^^^^^^^^^^^^
File "/Users/andreualegre/MassWappalyzer/masswappalyzer.py", line 185, in init
self._wappalyzer = self.Wappalyzer.Wappalyzer.latest(update=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Wappalyzer.latest() got an unexpected keyword argument 'update'
Can anyone help me out?
Thank you!
I have already installed everything and tried different ways to run this code. However, couldn't be able to get the solution. I have also asked the dev fro GitHub's, but he haven't answered yet, that's why I am asking here.
I am running a jenkins pipeline for my testing project using ctest, and I want to have a test report for it.
When I try to use junit2html to parse the output of Test.xml, which is generated by ctest, it will throw could not find test suites in results xml error.
Does anyone knows that how this error occurs and how to fix it?
Thanks in advance.
Details
After I generate the test report with ctest:
ctest --no-compress-output -T Test
# generate Testing/<date-time>/Test.xml
Then I want to create a html report by junit2html module :
python3 -m junit2htmlreport Testing/*/Test.xml
It will throw an error :
$ python3 -m junit2htmlreport Testing/20220802-0720/Test.xml test_report.html
Traceback (most recent call last):
File "/usr/lib64/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/junit2htmlreport/__main__.py", line 6, in <module>
runner.start()
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/junit2htmlreport/runner.py", line 103, in start
run(sys.argv[1:])
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/junit2htmlreport/runner.py", line 90, in run
report = parser.Junit(args[0])
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/junit2htmlreport/parser.py", line 340, in __init__
self.process()
File "/var/lib/jenkins/.local/lib/python3.6/site-packages/junit2htmlreport/parser.py", line 376, in process
raise ParserError("could not find test suites in results xml")
junit2htmlreport.parser.ParserError: could not find test suites in results xml
I am not sure why my python 3.9 idle isnt opening VIDEO I have tried multiple times but it still isnt opening for me
I tried repairing it in control panel but it still isnt working
I also tried to reinstall it but I am still having the same problem it just wont open no matter how much I click
my idle path on my folder enter image description here
C:\Users\Habib\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.9
on my IDle properties it says V
TARGET: C:\Users\Habib\AppData\Local\Programs\Python\Python39\pythonw.exe "C:\Users\Habib\AppData\Local\Programs\Python\Python39\Lib\idlelib\idle.pyw"
START: C:\Users\Habib\AppData\Local\Programs\Python\Python39\
OUTPUT I GET WHEN I PUT py -m idlelib
Traceback (most recent call last):
File "C:\Users\Habib\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\Habib\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\Habib\AppData\Local\Programs\Python\Python39\lib\idlelib\__main__.py", line 6, in <module>
import idlelib.pyshell
File "C:\Users\Habib\AppData\Local\Programs\Python\Python39\lib\idlelib\pyshell.py", line 49, in <module>
from idlelib.colorizer import ColorDelegator
File "C:\Users\Habib\AppData\Local\Programs\Python\Python39\lib\idlelib\colorizer.py", line 6, in <module>
from idlelib.config import idleConf
File "C:\Users\Habib\AppData\Local\Programs\Python\Python39\lib\idlelib\config.py", line 766, in <module>
idleConf = IdleConf()
File "C:\Users\Habib\AppData\Local\Programs\Python\Python39\lib\idlelib\config.py", line 166, in __init__
self.LoadCfgFiles()
File "C:\Users\Habib\AppData\Local\Programs\Python\Python39\lib\idlelib\config.py", line 758, in LoadCfgFiles
self.userCfg[key].Load() #same keys
File "C:\Users\Habib\AppData\Local\Programs\Python\Python39\lib\idlelib\config.py", line 77, in Load
self.read(self.file)
File "C:\Users\Habib\AppData\Local\Programs\Python\Python39\lib\configparser.py", line 697, in read
self._read(fp, filename)
File "C:\Users\Habib\AppData\Local\Programs\Python\Python39\lib\configparser.py", line 1082, in _read
raise MissingSectionHeaderError(fpname, lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.
file: 'C:\\Users\\Habib\\.idlerc\\config-main.cfg', line: 1
'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
Python 3.9 is very new and it may not be working with your system try switching back to python 3.8.6 and it looks like you havent added python to path
I had the same problem and I was trying to open (pythonw.exe)
it turns out that I had to open Python\Lib\idlelib\idle.py type(python file(no console))
When I use the VS Code debugger with Python to stop at some breakpoints, I often write some lines straight in the debug console (use it as interactive Python shell within my program).
The problem is, when I have errors in these lines, when typed from the debug console, I don't see the full Python-style traceback of the error, but only the last line (<Error_type>: ), i.e., without references to code file where the error was raised, the line raised it, and the full stack trace.
Is there any way to configure the VS Code debugger to show the full traceback for errors raised by lines executed from the debugger?
I develop (and debug) on remote machine through ssh.
Example:
I wrote a file named tmp2.py, which contains:
class A:
def __init__(self, val):
print(val)
a = A()
If I put debug point on line 5: print('start'),
and then from the debug console type directly a = A(), I see this one line output:
TypeError: __init__() missing 1 required positional argument: 'val'
but if I run the full program I see the this elaborated output:
Traceback (most recent call last):
File "/home/innereye/anaconda2/envs/py3tf2/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/home/innereye/anaconda2/envs/py3tf2/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/innereye/.vscode-server/extensions/ms-python.python-2020.6.91350/pythonFiles/lib/python/debugpy/__main__.py", line 45, in <module>
cli.main()
File "/home/innereye/.vscode-server/extensions/ms-python.python-2020.6.91350/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 430, in main
run()
File "/home/innereye/.vscode-server/extensions/ms-python.python-2020.6.91350/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 267, in run_file
runpy.run_path(options.target, run_name=compat.force_str("__main__"))
File "/home/innereye/anaconda2/envs/py3tf2/lib/python3.7/runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "/home/innereye/anaconda2/envs/py3tf2/lib/python3.7/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "/home/innereye/anaconda2/envs/py3tf2/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/innereye/deeplearning/tmp2.py", line 6, in <module>
a = A()
TypeError: __init__() missing 1 required positional argument: 'val'
which directs me to the actual file and line where the error raises.
I want the debugger to show me the second output also for lines executed directly from the debug console.
Sorry, but it seems like impossibleļ¼ VSCode hasn't provided related configuration. And I consider that's very hard to get what you want, this is because of the debug theory.
I'm trying to run a Keras multi-layer perceptron model using Google Cloud ML engine (following the format put forward in tutorials such as https://github.com/clintonreece/keras-cloud-ml-engine and http://liufuyang.github.io/2017/04/02/just-another-tensorflow-beginner-guide-4.html) and my dataset is in the form of .mat files (which as far as I know are not 7.3 format, so don't need HDF5).
The training set files are in a file called "data" in a Google Cloud storage bucket called project_1; I also have them stored locally. I modified my model for cloud use such that it loads the .mat files as follows:
def train_model (train_file='data', job_dir='./tmp/mlp2', **args):
with file_io.FileIO(train_file + '/train_subject01.mat', mode='r') as a:
train_data = scipy.io.loadmat(a)
etc.
When I run the model locally using gcloud commands (with --train-file ./data ) it works smoothly. However, when I try to deploy it to run on the cloud using
$ export BUCKET_NAME=project_1
....
> --train-file gs://$BUCKET_NAME/data
as seems to be common practice, I get an error message as follows:
The replica master 0 exited with a non-zero status of 1. Termination reason: Error.
Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals
File "/root/.local/lib/python2.7/site-packages/trainer/mlp2.py", line 195, in <module> train_model(**arguments)
File "/root/.local/lib/python2.7/site-packages/trainer/mlp2.py", line 39, in train_model train_data = scipy.io.loadmat(a)
File "/usr/local/lib/python2.7/dist-packages/scipy/io/matlab/mio.py", line 135, in loadmat matfile_dict = MR.get_variables(variable_names)
File "/usr/local/lib/python2.7/dist-packages/scipy/io/matlab/mio5.py", line 272, in get_variables hdr, next_position = self.read_var_header()
File "/usr/local/lib/python2.7/dist-packages/scipy/io/matlab/mio5.py", line 232, in read_var_header header = self._matrix_reader.read_header(check_stream_limit)
File "scipy/io/matlab/mio5_utils.pyx", line 558, in scipy.io.matlab.mio5_utils.VarReader5.read_header (scipy/io/matlab/mio5_utils.c:5684)
File "scipy/io/matlab/mio5_utils.pyx", line 610, in scipy.io.matlab.mio5_utils.VarReader5.read_header (scipy/io/matlab/mio5_utils.c:5609)
File "scipy/io/matlab/mio5_utils.pyx", line 481, in scipy.io.matlab.mio5_utils.VarReader5.read_int8_string (scipy/io/matlab/mio5_utils.c:4635)
File "scipy/io/matlab/mio5_utils.pyx", line 362, in scipy.io.matlab.mio5_utils.VarReader5.read_element (scipy/io/matlab/mio5_utils.c:3994)
File "scipy/io/matlab/streams.pyx", line 55, in scipy.io.matlab.streams.GenericStream.seek (scipy/io/matlab/streams.c:1401)
TypeError: seek() takes exactly 2 arguments (3 given)
I have no idea what this seek() error means! Am I using the right method to load the file, and if so, why is the issue popping up? Is there an alternative way to load the file?