Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SKiDL Bug] - Differing errors depending on source installation of netlistsvg package (also, can't generate SVG) #126

Open
Oops-All-Braces opened this issue Aug 31, 2021 · 1 comment
Labels

Comments

@Oops-All-Braces
Copy link

Oops-All-Braces commented Aug 31, 2021

Describe the bug
When installing netlistsvg in two different ways (Globally; from GitHub, from NPM Repo), errors reported are inconsistent (cannot generate SVG).

To Reproduce
Prerequisites and assumptions:

  1. Running a Windows 10 Pro system;
  2. Installation of Python (3.9.6) on Windows (Local User Only);
  3. Created a Python virtual environment;
  4. Installed additional PIP packages pip-freeze.txt
  5. Installed Windows Graphviz support package (2.49.0)
  6. Configured local Node.js environment in PIP environment (16.8.0)
  7. Using Visual Studio Code IDE (1.59.1);
  8. Python virtual environment configured as environment runtime in VS Code;
  9. Additional symbol library files from Texas Instruments (if using my specific code)

Steps to reproduce the behavior:
Part 1

  1. Install netlistsvg globally from NPM repository: npm install -g netlistsvg
  2. Create a standard file (or use mine: 8235_Module.py.txt)
  3. Attempt to run/debug code in VS Code with generate_svg() called at the end; see results
  4. npm uninstall -g netlistsvg
  5. Verify package uninstalled.

Part 2

  1. Install netlistsvg globally from GitHub repository: npm install https://github.com/nturley/netlistsvg
  2. Create a standard file (or use mine: 8235_Module.py.txt)
  3. Attempt to run/debug code in VSCode with generate_svg() called at the end; see results
  4. WORKAROUND: install netlistsvg globally from NPM repository npm install -g netlistsvg
  5. Uninstall netlistsvg: npm uninstall -g netlistsvg
  6. Verify package uninstalled.

Expected behavior
System reports same or similar error for each netlistsvg installation (and/or generates an SVG)

Screenshots
N/A

Desktop (please complete the following information):

  • Windows 10 Pro (10.0.19042)
  • Python version (3.9.6)
  • SKiDL version [e.g. 22] (1.0.0 PIP)

Additional context
Hey, there. Hope things are going well, all things considered.

I'm trying to leverage the netlistsvg package (1.0.2) with skidl (1.0.0) in a node.js (16.8.0) environment cohabitating with a Python virtual environment (3.9.6) on a Windows 10 Pro (10.0.19042) system. I am using Visual Studio Code with the Python virtual environment configured as the default Python runtime (so it starts the environment automagically). This Python environment has the nodeenv (1.6.0) package installed via pip and is how I've nested the node.js environment alongside the Python environment.

I've reviewed the netlistsvg installation instructions on their GitHub as well as on the SKiDL website. Both of them have slightly different instructions:

SKiDL netlistsvg Installation Instructions (https://xess.com/skidl/docs/_site/#svg-schematics)
npm install https://github.com/nturley/netlistsvg

netlistsvg GitHub Home Page (https://github.com/nturley/netlistsvg)
npm install -g netlistsvg

The SKiDL installation method doesn't work at all; because the package is installed locally, it doesn't seem to get picked up on since the function seems to want to use a globally installed NPM package (and I'll admit my node.js ignorance here, since it's not a framework I use for development of any sort) and as a result, it can't find the actual netlistsvg binary. However, I'll return to this later.

When using the netlistsvg GitHub instructions to install the package, I receive the following error:

d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\built\Skin.js:11
                return e[1]['s:pid'].startsWith(prefix);
                                     ^

TypeError: Cannot read property 'startsWith' of undefined
    at d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\built\Skin.js:11:38
    at arrayFilter (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\lodash\lodash.js:596:11)
    at Function.filter (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\lodash\lodash.js:9241:14)
    at Object.getPortsWithPrefix (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\built\Skin.js:9:23)
    at Cell.buildElkChild (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\built\Cell.js:213:36)
    at d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\built\elkGraph.js:12:18
    at Array.map (<anonymous>)
    at Object.buildElkGraph (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\built\elkGraph.js:11:33)
    at Object.render (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\built\index.js:43:29)
    at render (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\bin\netlistsvg.js:23:9)
    at d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\bin\netlistsvg.js:57:9
    at d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\bin\netlistsvg.js:41:17
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)

This is similar to #118, where the solution was to completely reinstall the environment. This was done within the Python virtual environment, pyenv by uninstalling any components, up to and including nodeenv, but this did not resolve the core issue of being unable to generate a "pretty" SVG file.

At this point, I tried to use the GitHub installation instructions again, this time specifying a global installation for the GitHub pull of the netlistsvg library:
npm install -g https://github.com/nturley/netlistsvg

This succeeded, and the code ran, however, there was another interesting error that was generated (and it did not match the original error I was getting from simply installing as a global package via NPM):

Error: java.lang.IllegalStateException: Invalid hitboxes for scanline constraint calculation.
    at icb.Mx [as Wd] (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:6049:84194)
    at icb.Sx [as _d] (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:6049:84455)
    at icb.Kx (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:2530:48)       
    at icb.Vx (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:1133:19)       
    at new icb (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:1166:20)      
    at zCb (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:5321:58)
    at yCb (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:4957:31)
    at BCb.CCb [as Ke] (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:6049:134602)
    at pBb (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:4572:152)
    at rBb (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:3040:48)
    at uCb (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:4992:166)
    at Ccc.Dcc [as Me] (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:6049:201698)
    at WBb (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:4531:143)
    at ZBb (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:5891:189)
    at $Bb (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:5204:97)
    at Kdc (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:5764:448)
    at Ldc.Qdc [as nf] (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:6049:205955)
    at JRb (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:5753:333)
    at HRb (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:5090:113)
    at gSb.hSb [as $e] (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:6049:160432)
    at b$c (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:4340:54)
    at e$c (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:5982:996)
    at d$c (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:4905:177)
    at Iqd (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:5685:353)
    at h.dispatch (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:5984:473)  
    at h.saveDispatch (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:5984:603)
    at Timeout._onTimeout (d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\node_modules\elkjs\lib\elk-worker.min.js:5985:162)
    at listOnTimeout (node:internal/timers:557:17)
    at processTimers (node:internal/timers:500:7)
d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\built\index.js:67
            throw Error(reason);
                  ^

Error: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
    at d:\User\Documents\Workspaces\Workspace\pyenv\Scripts\node_modules\netlistsvg\built\index.js:67:19

A manual test of the netlistsvg package revealed that, similar to issue #118, if I used the generated JSON output file only to try and generate an SVG output, it worked. However, when I tried to use the accompanying skin file, it ABENDed with the error listed above. I found it curious that the error wasn't consistent across the installation methods and wanted to report it.

I will go through the process of standing up an additional Workspace and Python virtual environment, just in case that's the problem with SVG generation as in #118 (that's the next step for me to try), but once again, main reason for opening this is to point out the error inconsistency when installing netlistsvg two different ways.

Please let me know if you have any additional questions or need any additional information from me.

Thank you!

@devbisme
Copy link
Owner

Very complete error report!

I think what you're seeing with regard to the different errors is that the netlistsvg installed from the global NPM repository does not include a revision I submitted to correct the error you saw (startsWith error). But the most current netlistsvg available from the Github repo has a new error (TypeError) that I haven't tracked down, yet. So your problems are similar to what was reported in #118 and the solution is (unfortunately) to wait for me to figure out what is going on. But, you should use the Github version of netlistsvg regardless since it is the most up-to-date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants