Unable to build V8 in Windows 10 - python

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.

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!

Error during automated software install using pywinauto

After searching I am not able to find a good response:
I am trying to automate company software using pywinauto. I try to use app.print_control_identifiers() wherever possible. And it has been a God send! Thanks to folks on Youtube and Vasily's posts. See code below.
During the install, it wants to install a MS VC++ redistributable and I can handle that.
The next issue is telling me that the version of Adobe Flash Player (I know right?) is incompatible. I have used Inspect to ID the OK button I need to click to move on. Here is the code (cleaned up for public consumption):
from pywinauto.application import Application
import time
app = Application(backend="uia").start("C:\\Users\\me\\program.exe")
time.sleep(5)
#This addresses the need to install Microsoft C++ Redistributable
dlg = app['program - InstallShield Wizard']
dlg.Install.click()
time.sleep(5)
#This is to get past an install failure and to move on
dlg.Yes.click()
time.sleep(10)
#This is a dialog box saying that some component is incompatible and this is where I am stuck
# And the window title now just says 'program' vs. 'program - InstallShield Wizard'
new_dlg = app['program']
new_dlg.OK.click()
Here is the failure info:
C:\Python37\python.exe C:/Users/me/PycharmProjects/myProject/pywinauto_install.py
Traceback (most recent call last):
File "C:\Python37\lib\site-packages\pywinauto\application.py", line 258, in __resolve_control
criteria)
File "C:\Python37\lib\site-packages\pywinauto\timings.py", line 458, in wait_until_passes
raise err
pywinauto.timings.TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/me/PycharmProjects/myProject/pywinauto_install.py", line 23, in <module>
new_dlg.OK.click()
File "C:\Python37\lib\site-packages\pywinauto\application.py", line 379, in __getattribute__
ctrls = self.__resolve_control(self.criteria)
File "C:\Python37\lib\site-packages\pywinauto\application.py", line 261, in __resolve_control
raise e.original_exception
File "C:\Python37\lib\site-packages\pywinauto\timings.py", line 436, in wait_until_passes
func_val = func(*args, **kwargs)
File "C:\Python37\lib\site-packages\pywinauto\application.py", line 203, in __get_ctrl
dialog = self.backend.generic_wrapper_class(findwindows.find_element(**criteria[0]))
File "C:\Python37\lib\site-packages\pywinauto\findwindows.py", line 87, in find_element
raise ElementNotFoundError(kwargs)
pywinauto.findwindows.ElementNotFoundError: {'best_match': 'program', 'backend': 'uia', 'process': 22184}
Process finished with exit code 1
I am creating new_dlg based on an SO post I saw, so if this is wrong, please slap my hand. I am not a trained developer.
Thanks
To check texts of the top level dialog windows print this:
print([w.window_text() for w in app.windows()])
Then just copy the correct one to your code as a dict key instead of app['program']. More flexible way looks so:
new_dlg = app.window(title_re="Program - .*")

FMUException: Failed to setup the experiment

I have a fmu which is created in GT-Suite and am trying to work with it in python.
I have followed jmodelica tutorials
from pyfmi import load_fmu
model = load_fmu('myFMU.fmu')
res = model.simulate(final_time=10)
My fmu gets loaded but when I try to run model.simulate step it throws an error
Traceback (most recent call last):
File "<ipython-input-3-4812da4bb52b>", line 1, in <module>
res = model.simulate(final_time=10)
File "src\pyfmi\fmi.pyx", line 6981, in pyfmi.fmi.FMUModelCS2.simulate
File "src\pyfmi\fmi.pyx", line 304, in pyfmi.fmi.ModelBase._exec_simulate_algorithm
File "src\pyfmi\fmi.pyx", line 298, in pyfmi.fmi.ModelBase._exec_simulate_algorithm
File "C:\Users\chinn\Anaconda3\envs\test_env\lib\site-packages\pyfmi\fmi_algorithm_drivers.py", line 761, in __init__
self.model.setup_experiment(start_time=start_time, stop_time_defined=self.options["stop_time_defined"], stop_time=final_time)
File "src\pyfmi\fmi.pyx", line 4292, in pyfmi.fmi.FMUModelBase2.setup_experiment
FMUException: Failed to setup the experiment.
I have tried running it in multiple environments in my pc but am getting the same error. Googled a lot but couldn't find anything. Can some one help me with resolving this issue?
The fmu is probably not exported with the correct license setting.

How can I compile Bootstrap 4 scss with python webassets?

I'm trying to simply compile Bootstrap 4 with python webassets and having zero success. For now I'm just trying to do this within the bootstrap/scss directory so path issues are less of a big deal. Within this directory I have added a main.scss file with one line:
#import "bootstrap.scss";
I have a script called test_scss.py that looks like this:
from webassets import Bundle, Environment
my_env = Environment(directory='.', url='/')
css = Bundle('main.scss', filters='scss', output='all.css')
my_env.register('css_all', css)
print(my_env['css_all'].urls())
When I run this command, I get an error trace like this:
Traceback (most recent call last):
File "./test_scss.py", line 11, in <module>
print(my_env['css_all'].urls())
File "/Users/benlindsay/miniconda/lib/python3.6/site-packages/webassets/bundle.py", line 806, in urls
urls.extend(bundle._urls(new_ctx, extra_filters, *args, **kwargs))
File "/Users/benlindsay/miniconda/lib/python3.6/site-packages/webassets/bundle.py", line 765, in _urls
*args, **kwargs)
File "/Users/benlindsay/miniconda/lib/python3.6/site-packages/webassets/bundle.py", line 619, in _build
force, disable_cache=disable_cache, extra_filters=extra_filters)
File "/Users/benlindsay/miniconda/lib/python3.6/site-packages/webassets/bundle.py", line 543, in _merge_and_apply
kwargs=item_data)
File "/Users/benlindsay/miniconda/lib/python3.6/site-packages/webassets/merge.py", line 276, in apply
return self._wrap_cache(key, func)
File "/Users/benlindsay/miniconda/lib/python3.6/site-packages/webassets/merge.py", line 218, in _wrap_cache
content = func().getvalue()
File "/Users/benlindsay/miniconda/lib/python3.6/site-packages/webassets/merge.py", line 251, in func
getattr(filter, type)(data, out, **kwargs_final)
File "/Users/benlindsay/miniconda/lib/python3.6/site-packages/webassets/filter/sass.py", line 196, in input
self._apply_sass(_in, out, os.path.dirname(source_path))
File "/Users/benlindsay/miniconda/lib/python3.6/site-packages/webassets/filter/sass.py", line 190, in _apply_sass
return self.subprocess(args, out, _in, cwd=child_cwd)
File "/Users/benlindsay/miniconda/lib/python3.6/site-packages/webassets/filter/__init__.py", line 527, in subprocess
proc.returncode, stdout, stderr))
webassets.exceptions.FilterError: scss: subprocess returned a non-success result code: 65, stdout=b'',
stderr=b'DEPRECATION WARNING: Importing from the current working directory will
not be automatic in future versions of Sass. To avoid future errors, you can add it
to your environment explicitly by setting `SASS_PATH=.`, by using the -I command
line option, or by changing your Sass configuration options.
Error: Invalid CSS after "...lor}: #{$value}": expected "{", was ";"
on line 4 of /Users/benlindsay/scratch/python/webassets/test-2/bootstrap/scss/_root.scss
from line 11 of /Users/benlindsay/scratch/python/webassets/test-2/bootstrap/scss/bootstrap.scss
from line 1 of standard input
Use --trace for backtrace.
If I follow the instructions and set environment variable SASS_PATH=., that gets rid of that part of the error message, but I still get the error
Error: Invalid CSS after "...lor}: #{$value}": expected "{", was ";"
on line 4 of /Users/benlindsay/scratch/python/webassets/test-2/bootstrap/scss/_root.scss
from line 11 of /Users/benlindsay/scratch/python/webassets/test-2/bootstrap/scss/bootstrap.scss
from line 1 of standard input
Use --trace for backtrace.
I don't know SCSS syntax well yet, but I'd bet a lot of money this is me doing something wrong and not an error in the Bootstrap SCSS. Any thoughts of what I'm doing wrong would be greatly appreciated.
Turns out it actually kind of was a problem on Bootstrap's end. See https://github.com/sass/sass/issues/2383, specifically the quote:
This is a bug in our implementation—the parser shouldn't crash—but those Bootstrap styles aren't valid for Sass 3.5 as written.
Anyway, I just needed to update to the latest version of Ruby Sass (which apparently the webassets module depends on) and that fixed it.

Winerror 3: File not found using ac2git

I was using the ac2git tool to concert my accurev depot to git repository.
I am getting the following error when running the command python ac2git.py after following the necessary steps, as instructed here.
2016-08-29 09:54:14,058 - ac2git - ERROR - The script has encountered an exception, aborting!
Traceback (most recent call last):
File "ac2git.py", line 3596, in AccuRev2GitMain
rv = state.Start(isRestart=args.restart, isSoftRestart=args.softRestart)
File "ac2git.py", line 2974, in Start
self.RetrieveStreams()
File "ac2git.py", line 1556, in RetrieveStreams
tr, commitHash = self.RetrieveStream(depot=depot, stream=streamInfo,dataRef=dataRef, stateRef=stateRef, hwmRef=hwmRef, startTransaction=self.config.accurev.startTransaction, endTransaction=endTr.id)
File "ac2git.py", line 1511, in RetrieveStream
dataTr, dataHash = self.RetrieveStreamData(stream=stream, dataRef=dataRef,stateRef=stateRef)
File "ac2git.py", line 1394, in RetrieveStreamData
commitHash = self.Commit(transaction=tr, allowEmptyCommit=True,messageOverride="transaction {trId}".format(trId=tr.id), parents=[], ref=dataRef)
File "ac2git.py", line 670, in Commit
self.PreserveEmptyDirs()
File "ac2git.py", line 440, in PreserveEmptyDirs
if git.GetGitDirPrefix(path) is None and len(os.listdir(path)) == 0:
FileNotFoundError: [WinError 3] The system cannot find the path specified:'C:///Users/*****/*****/app/node_modules/bower/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/registry-url/node_modules/npmconf/node_modules/config-chain/node_modules/proto-list'
The error is quite vague and I can't seem to find any documentation on this tool that can help with the error. Has anyone faced this issue before?
I am not familiar with the tool you are using but it seems the last line in the output excerpt you provided gives the best information:
FileNotFoundError: [WinError 3] The system cannot find the path specified:'C:///Users/*****/*****/app/node_modules/bower/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/registry-url/node_modules/npmconf/node_modules/config-chain/node_modules/proto-list'
That path looks to be malformed with extra slashes and directory names that are not valid within the file system. Also, the file path is at 227 characters in the output and if the directory names between "Users" and "app" are long enough, you could be hitting the 256 character path name limit in Windows.

Categories