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

wavedrompy fails to work on files generated by wavedrom #37

Open
Araneidae opened this issue May 16, 2022 · 3 comments
Open

wavedrompy fails to work on files generated by wavedrom #37

Araneidae opened this issue May 16, 2022 · 3 comments

Comments

@Araneidae
Copy link

I'm not sure if this is a duplicate issue (certainly issue #34 seems to cover the same ground, but doesn't actually state the issue).

If I run wavedrompy -i test-file.json -s test-file.svg on a file generated using the wavedrom editor I get the following error message:

json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

I understand that the underlying issue is that the wavedrom file format (an example is shown below):

{signal: [
  {name: 'e', wave: '0.30.30..', data: ['τ', 'τ+1']},
  {name: 'x', wave: 'x.=x.=x..', data: ['x₀', 'x₁']},
  {name: 'δₑx', wave: 'x..=..=..', data: ['x₀', 'x₁']},
  {name: 'δe', wave: '0..30.30.', data: ['τ', 'τ+1']},
]}

is in what is referred to as "relaxed JSON", or really Javascript, which is a dialect the Python JSON decoder doesn't appear to understand.

wallento added a commit that referenced this issue May 27, 2022
Javascript allows json with missing quotes around text, this adds an
extra step that handles the issue (thanks @fsmMLK).

Fixes #34 and #37
@wallento
Copy link
Owner

I think this is fixed with https://pypi.org/project/wavedrom/2.0.3.post3/
can you confirm that?

@angelopereira
Copy link

Hello, I have installed 2.0.3.post3. The relaxed JSON works fine for digital signals. However I am unable to make the piecewise linear analog signal syntax work in this package. I am able to successfully render analog signals in the native wavedrom editor. Please see exact example below consisting of 2 analog signals and 3 digital signals. When I use the wave: ['pw', {d: 'm,0,0 h,0.5,0 l,1,5 h,12.5'}] syntax directly I get the error of "TypeError: unhashable type: 'dict'". If I place the contents within {d: 'm,0,0 h,0.5,0 l,1,5 h,12.5'} in a dict and name it say "dict1", and then use dict1 in the wave description I do not get this error but the waveform does not get rendered either. Any suggestions on how I might overcome this syntactical issue?

{signal: [
{name: '', wave: '1.............'},
{},
['VIN',
{name:'12V'},
{name:'10V'},
{name:'5V'},
{name: '0V', wave: ['pw', {d: 'm,0,0 h,0.5,0 l,1,5 h,12.5'}]}
],
{},
{name:'5V'},
{name:'4.3V'},
{name:'VOUT 3.6V'},
{name:'1.8V'},
{name: '0V', wave: ['pw', {d: 'm,0,0 q,0.5,4,3,4 h,3 L,7,5 h,4 L,12,6 h,2'}]},
{name: 'dig1', wave: "x.......0..1.."},
{name: 'dig2', wave: "01......0....."},
{name: 'dig3', wave: "x.......3..4..",data:["00","11"]}
]}

@gipi
Copy link

gipi commented Aug 26, 2022

I don't know what changes happened what suddenly my wavedrom JSON stopped working, an example here, it seems that tabs are now allowed anymore.

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

No branches or pull requests

4 participants