In virtual environment I installed locust.
I want to create distributable package so any user can run load tests.
I used pyinstaller.
The exe file is created but when I run it nothing happens.
from locust import HttpUser, TaskSet, task
import orjson as json
def create_post(self):
paramsDict = {}
paramsDict = json.loads('{ ...myjson.. }')
params = json.dumps(paramsDict) #for orjson
headers = {'content-type': 'application/json','Accept-Encoding':'gzip'}
response = self.client.post("/",data= params, headers=headers, name = "Post query")
print(f'response -> {response}')
class WebsiteUser(HttpUser):
tasks = [create_post]
I used locust as library as Axel pointed.
I build with pyinstaller and tests runs just web page is not displayed
I build with pyinstaller but web did not appear `response -> <Response [200]>
Traceback (most recent call last):
File "gevent\pywsgi.py", line 999, in handle_one_response
File "gevent\pywsgi.py", line 945, in run_application
File "flask\app.py", line 2464, in __call__
File "flask\app.py", line 2450, in wsgi_app
File "flask\app.py", line 1867, in handle_exception
File "flask\_compat.py", line 39, in reraise
File "flask\app.py", line 2447, in wsgi_app
File "flask\app.py", line 1952, in full_dispatch_request
File "flask\app.py", line 1821, in handle_user_exception
File "flask\_compat.py", line 39, in reraise
File "flask\app.py", line 1950, in full_dispatch_request
File "flask\app.py", line 1936, in dispatch_request
File "locust\web.py", line 419, in wrapper
File "locust\web.py", line 132, in index
File "flask\templating.py", line 138, in render_template
File "jinja2\environment.py", line 930, in get_or_select_template
File "jinja2\environment.py", line 883, in get_template
File "jinja2\environment.py", line 857, in _load_template
File "jinja2\loaders.py", line 115, in load
File "flask\templating.py", line 60, in get_source
File "flask\templating.py", line 89, in _get_source_fast
jinja2.exceptions.TemplateNotFound: index.html
2021-01-11T11:29:52Z {'REMOTE_ADDR': '127.0.0.1', 'REMOTE_PORT': '61083', 'HTTP_HOST': 'localhost:8089', (hidden keys: 31)} failed with TemplateNot
The template needs to be included in build.
Into spec file I added into data section as well as static with java scripts and css
datas=[('<path>\\Lib\\site-packages\\locust\\templates', 'locust\\templates'),('<path>\\Lib\\site-packages\\locust\\static', 'locust\\static')],
With Inno Setup I added also those to folders to be in same folder as executable.
And web page is displayed.
All depend on how are you expecting to get your test executed and what are your really packing. Locust have different ways of use. Assuming that you wanna pack your test file as an executable file you may need to include in your file a main entrypoint that use locust as a library
If you are packing the locust itself and the virtualenv including your test file you may need to specify how to run locust as a command and pass your test file as a command line argument
Related
I'm trying to create a dataflow pipeline but I get this error in my powershell console
Traceback (most recent call last):
File "load_pole_emploi.py", line 107, in <module>
run()
File "load_pole_emploi.py", line 92, in run
gcs_bucket_name + file_pattern)
File "E:\Utilisateurs\SI084342\venv\gcp\lib\site-packages\apache_beam\io\textio.py", line 675, in __init__
escapechar=escapechar)
File "E:\Utilisateurs\SI084342\venv\gcp\lib\site-packages\apache_beam\io\textio.py", line 132, in __init__
validate=validate)
File "E:\Utilisateurs\SI084342\venv\gcp\lib\site-packages\apache_beam\io\filebasedsource.py", line 124, in __init__
self._validate()
File "E:\Utilisateurs\SI084342\venv\gcp\lib\site-packages\apache_beam\options\value_provider.py", line 193, in _f
return fnc(self, *args, **kwargs)
File "E:\Utilisateurs\SI084342\venv\gcp\lib\site-packages\apache_beam\io\filebasedsource.py", line 185, in _validate
match_result = FileSystems.match([pattern], limits=[1])[0]
File "E:\Utilisateurs\SI084342\venv\gcp\lib\site-packages\apache_beam\io\filesystems.py", line 203, in match
filesystem = FileSystems.get_filesystem(patterns[0])
File "E:\Utilisateurs\SI084342\venv\gcp\lib\site-packages\apache_beam\io\filesystems.py", line 106, in get_filesystem
'e.g., pip install apache-beam[gcp]. Path specified: %s' % path)
ValueError: Unable to get filesystem from specified path, please use the correct path or ensure the required dependency is installed, e.g., pip install apache-beam[gcp]. Path specified: gs://bck-fr-fichiers-manuel-dev/de_par_categorie_et_code_rome/file.csv
I have re installed apache beam[gcp] but the problem still remains
Any help, thanks
thank you, it was related to missing apache beam test and docs
Keep getting this error message when I enter this code :
data = pd.read_csv('1.01. Simple linear regression.csv')
Traceback (most recent call last):
File "<pyshell#7>", line 1, in <module>
data = pd.read_csv('1.01. Simple linear regression.csv')
File "/usr/lib/python3/dist-packages/pandas/io/parsers.py", line 678, in parser_f
return _read(filepath_or_buffer, kwds)
File "/usr/lib/python3/dist-packages/pandas/io/parsers.py", line 440, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
File "/usr/lib/python3/dist-packages/pandas/io/parsers.py", line 787, in __init__
self._make_engine(self.engine)
File "/usr/lib/python3/dist-packages/pandas/io/parsers.py", line 1014, in _make_engine
self._engine = CParserWrapper(self.f, **self.options)
File "/usr/lib/python3/dist-packages/pandas/io/parsers.py", line 1708, in __init__
self._reader = parsers.TextReader(src, **kwds)
File "pandas/_libs/parsers.pyx", line 384, in pandas._libs.parsers.TextReader.__cinit__
File "pandas/_libs/parsers.pyx", line 695, in pandas._libs.parsers.TextReader._setup_parser_source
And the message :
FileNotFoundError: File b'1.01. Simple linear regression.csv' does not exist
(Best end a question with the question.) The current working directory for the program does not have a file by that name. Possible solutions:
Give a complete path to the file to read_csv.
Change the working directory in the program to the one that contain that file using os.chdir. See chdir doc.
Start python in that directory, with or without IDLE, from a command line.
I am running Anaconda - conda virtual env with Python 2.7
I have followed Apache Beam Python SDK Quickstart
When I run -
'python -m apache_beam.examples.wordcount --input C:\Users\simon_6dagkya\OneDrive\ProgrammingCore\Apache Beam\examples\wordcount\kinglear.txt --output C:\Users\simon_6dagkya\OneDrive\ProgrammingCore\Apache Beam\examples\wordcount\output.txt'
I get following error:
INFO:root:Missing pipeline option (runner). Executing pipeline using the default runner: DirectRunner.
Traceback (most recent call last):
File "C:\Users\simon_6dagkya\Anaconda3\envs\apachebeam\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\Users\simon_6dagkya\Anaconda3\envs\apachebeam\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Users\simon_6dagkya\Anaconda3\envs\apachebeam\lib\site-packages\apache_beam\examples\wordcount.py", line 136, in <module>
run()
File "C:\Users\simon_6dagkya\Anaconda3\envs\apachebeam\lib\site-packages\apache_beam\examples\wordcount.py", line 90, in run
lines = p | 'read' >> ReadFromText(known_args.input)
File "C:\Users\simon_6dagkya\Anaconda3\envs\apachebeam\lib\site-packages\apache_beam\io\textio.py", line 524, in __init__
skip_header_lines=skip_header_lines)
File "C:\Users\simon_6dagkya\Anaconda3\envs\apachebeam\lib\site-packages\apache_beam\io\textio.py", line 119, in __init__
validate=validate)
File "C:\Users\simon_6dagkya\Anaconda3\envs\apachebeam\lib\site-packages\apache_beam\io\filebasedsource.py", line 121, in __init__
self._validate()
File "C:\Users\simon_6dagkya\Anaconda3\envs\apachebeam\lib\site-packages\apache_beam\options\value_provider.py", line 133, in _f
return fnc(self, *args, **kwargs)
File "C:\Users\simon_6dagkya\Anaconda3\envs\apachebeam\lib\site-packages\apache_beam\io\filebasedsource.py", line 181, in _validate
'No files found based on the file pattern %s' % pattern)
IOError: No files found based on the file pattern C:\Users\simon_6dagkya\OneDrive\ProgrammingCore\Apache
Any help most appreciated.
IOError: No files found based on the file pattern C:\Users\simon_6dagkya\OneDrive\ProgrammingCore\Apache
Your input string has a space in it. Add quotes.
today I've updated my parseconsole.exe and I can't deploy my code when yesterday I could.
I've try to do another develop but the same error happens, this is the trace:
> parse new WebContent
Creating directory C:\Users\NOTEBOOK\Documents\docs\Parse\Works_pars
e_luna\Prueba_node\WebContent\config
Creating config file C:\Users\NOTEBOOK\Documents\docs\Parse\Works_pa
rse_luna\Prueba_node\WebContent\config\global.json
Creating directory C:\Users\NOTEBOOK\Documents\docs\Parse\Works_pars
e_luna\Prueba_node\WebContent\cloud
Writing out sample file C:\Users\NOTEBOOK\Documents\docs\Parse\Works
_parse_luna\Prueba_node\WebContent\cloud\main.js
Creating directory C:\Users\NOTEBOOK\Documents\docs\Parse\Works_pars
e_luna\Prueba_node\WebContent\public
Writing out sample file C:\Users\NOTEBOOK\Documents\docs\Parse\Works
_parse_luna\Prueba_node\WebContent\public\index.html
Email: xxxxxx
Password:
1: prueba
2: prueba_cloud
Select an App: 2
PS C:\Users\NOTEBOOK\Documents\docs\Parse\Works_parse_luna\Prueba_no
de> cd WebContent
PS C:\Users\NOTEBOOK\Documents\docs\Parse\Works_parse_luna\Prueba_no
de\WebContent> parse deploy
Uploading source files
Traceback (most recent call last):
File "<string>", line 6, in <module>
File ".\build\pyi.win32\parse\out00-PYZ.pyz\main", line 695, in main
File ".\build\pyi.win32\parse\out00-PYZ.pyz\main", line 206, in handle_deploy
File ".\build\pyi.win32\parse\out00-PYZ.pyz\parse", line 332, in deploy
File ".\build\pyi.win32\parse\out00-PYZ.pyz\parse", line 231, in upload_source
_files
File ".\build\pyi.win32\parse\out00-PYZ.pyz\parse", line 39, in post
File ".\build\pyi.win32\parse\out00-PYZ.pyz\urllib2", line 126, in urlopen
File ".\build\pyi.win32\parse\out00-PYZ.pyz\urllib2", line 391, in open
File ".\build\pyi.win32\parse\out00-PYZ.pyz\urllib2", line 409, in _open
File ".\build\pyi.win32\parse\out00-PYZ.pyz\urllib2", line 369, in _call_chain
File ".\build\pyi.win32\parse\out00-PYZ.pyz\urllib2", line 1178, in https_open
File ".\build\pyi.win32\parse\out00-PYZ.pyz\urllib2", line 1142, in do_open
File ".\build\pyi.win32\parse\out00-PYZ.pyz\httplib", line 914, in request
File ".\build\pyi.win32\parse\out00-PYZ.pyz\httplib", line 954, in _send_request
File ".\build\pyi.win32\parse\out00-PYZ.pyz\httplib", line 759, in send
File ".\build\pyi.win32\parse\out00-PYZ.pyz\ssl", line 203, in sendall
File ".\build\pyi.win32\parse\out00-PYZ.pyz\ssl", line 174, in send
TypeError: write() argument 1 must be string or read-only buffer, not bytearray
thaks for your help
After reading https://stackoverflow.com/a/26982677/2211980, it seems that Parse has released a new version. I've just downloaded it from: https://www.parse.com/downloads/windows/console/parse.zip.
There is a deprecated warning but after seeing exactly the same errors as yours yesterday, I can now deploy, thankfully.
I know this thread is old but it may help newcomers in the future,
Parse announed that they made a change that require everyone to manually download the newest version of their CLI as of today (7.2.2015) the current version is 2.1.2 you can download it directly from the Parse.com
or if you like I made a repo containing the files for it, CLI Repo
Hope it helps.
Now there is a new version that is working.
Parse CLI v3.0.2
https://github.com/ParsePlatform/parse-cli/releases/
I'm trying to run doxyclean but can't get it to work, any help would be appreciated...
I'm running from terminal :
./doxyclean.py --input=./xml/ --output=./clean/ --name="MyProject" --phone -v
I have my doxygen xml in the folder xml, in the same directory as doxyclean.py
The result is :
Checking arguments
Cleaning XML files:
Traceback (most recent call last):
File "./doxyclean.py", line 1220, in <module>
sys.exit(main())
File "./doxyclean.py", line 1171, in main
cleanXML(filePath, xmlOutputDirectory)
File "./doxyclean.py", line 93, in cleanXML
if not fileIsDocumented(filePath):
File "./doxyclean.py", line 62, in fileIsDocumented
originaldoc = minidom.parse(filePath)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/dom/minidom.py", line 1918, in parse
return expatbuilder.parse(file)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/dom/expatbuilder.py", line 924, in parse
result = builder.parseFile(fp)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xml/dom/expatbuilder.py", line 207, in parseFile
parser.Parse(buffer, 0)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 17, column 155
thanks
did you try other ways, my suggestions
use different version of doxyclean
change the arguments to different style, maybe give full paths to the folders.
./doxyclean.py -i Users/xxx/doxyclean/xml/ -o ./clean/ -p
regenerate xml from doxygen
doxyclean works fine. I got this error too and I tried my suggestion 2 and it worked.