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

ValueError: 9 is not a valid PenColor #17

Closed
Utopiah opened this issue Nov 9, 2024 · 11 comments
Closed

ValueError: 9 is not a valid PenColor #17

Utopiah opened this issue Nov 9, 2024 · 11 comments

Comments

@Utopiah
Copy link

Utopiah commented Nov 9, 2024

Trying to convert from reMarkable Pro with highlights in color

@Azeirah
Copy link
Contributor

Azeirah commented Nov 9, 2024

Yep! This is a solved issue, but it hasn't been merged yet by @ricklupton

ricklupton/rmscene#31

@Utopiah
Copy link
Author

Utopiah commented Nov 22, 2024

As rmscene was released as v0.6.0 does the pipx install take that into account (didn't seem to) and if not, is there is way to force the upgrade?

@Seb-sti1
Copy link
Contributor

The released version of rmc currently uses rmscene = ">=0.1.0, <0.3.0" (see pyproject.toml#L10) so pipx mostly likely installs the 0.2.0.

There are some PRs to update rmc so that it can use a newer version of rmscene but it's still in the PR state for now :)

@Utopiah
Copy link
Author

Utopiah commented Nov 29, 2024

Thanks for the clarification. I'd argue it'd be great to go through those PRs because basically right now reMarkable Pro notes can't be exported anymore, at least not while using (some) colors.

@Seb-sti1
Copy link
Contributor

Yes, it's on its way (but it will probably take some time). In the meantime, you can try #18 (probably the best if you want colour) or #19 (doesn't support the new remarkable file features added by ricklupton/rmscene#31).

@Seb-sti1
Copy link
Contributor

Seb-sti1 commented Dec 2, 2024

@Utopiah could you try on the current version of master? Both #18 and #19 were merged by Rick Lupton

@ricklupton
Copy link
Owner

And now released as v0.2.0 ... hopefully that works with your files now.

@Utopiah
Copy link
Author

Utopiah commented Dec 2, 2024

Thanks, unfortunately I'm getting :

fabien@debian2080ti:~$ latestRemarkableProNoteToSVG 
48e02e7c-69b5-451f-a210-23c370a6ccf9.rm                                                                                        100%   93KB   5.0MB/s   00:00    
WARNING:rmscene.tagged_block_reader:Some data has not been read. The data may have been written using a newer format than this reader supports.
Traceback (most recent call last):
  File "/home/fabien/.local/bin/rmc", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/fabien/.local/pipx/venvs/rmc/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/fabien/.local/pipx/venvs/rmc/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/fabien/.local/pipx/venvs/rmc/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/fabien/.local/pipx/venvs/rmc/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/fabien/.local/pipx/venvs/rmc/lib/python3.11/site-packages/rmc/cli.py", line 58, in cli
    convert_rm(Path(fn), to, fout)
  File "/home/fabien/.local/pipx/venvs/rmc/lib/python3.11/site-packages/rmc/cli.py", line 135, in convert_rm
    tree_to_svg(tree, fout)
  File "/home/fabien/.local/pipx/venvs/rmc/lib/python3.11/site-packages/rmc/exporters/svg.py", line 80, in tree_to_svg
    x_min, x_max, y_min, y_max = get_bounding_box(tree.root, anchor_pos)
                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/fabien/.local/pipx/venvs/rmc/lib/python3.11/site-packages/rmc/exporters/svg.py", line 169, in get_bounding_box
    x_min_t, x_max_t, y_min_t, y_max_t = get_bounding_box(child, anchor_pos, (0, 0, 0, 0))
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/fabien/.local/pipx/venvs/rmc/lib/python3.11/site-packages/rmc/exporters/svg.py", line 165, in get_bounding_box
    for child_id in item.children:
  File "/home/fabien/.local/pipx/venvs/rmc/lib/python3.11/site-packages/rmscene/crdt_sequence.py", line 61, in __iter__
    yield from toposort_items(self._items.values())
  File "/home/fabien/.local/pipx/venvs/rmc/lib/python3.11/site-packages/rmscene/crdt_sequence.py", line 134, in toposort_items
    assert next_items
AssertionError
/home/fabien/new.svg:1: parser error : Document is empty

^
/home/fabien/new.svg:1: parser error : Document is empty

^
ink_file_open: '/home/fabien/new.svg' cannot be opened!
InkscapeApplication::document_open: Failed to open: /home/fabien/new.svg
ConcreteInkscapeApplication::on_open: failed to create document!
fabien@debian2080ti:~$ rmc -v
Usage: rmc [OPTIONS] [INPUT]...
Try 'rmc --help' for help.

Error: Must specify input filename or --from
fabien@debian2080ti:~$ rmc --version
rmc, version 0.2.0

on this .rm file https://fabien.benetou.fr/pub/home/rm_rmc_0.2_rmprotest.rm

@Seb-sti1
Copy link
Contributor

Seb-sti1 commented Dec 3, 2024

I was so confused at first, but everything is okay: it was fixed in ricklupton/rmscene#36 but this is not released yet.

You can "cheat" by doing pip uninstall rmscene and then using the main branch of rmscene with pip install git+https://github.com/ricklupton/rmscene.git. With this, I was able to export the svg for your file!

EDIT: If you have any other issue with AssertionError, please consider reopening ricklupton/rmscene#32

@ricklupton
Copy link
Owner

Thanks for checking @Seb-sti1 . I've enow released rmscene v0.6.1 with those changes so it should work if reinstalling rmc/rmscene.

@Utopiah
Copy link
Author

Utopiah commented Dec 4, 2024

Yeay, colors, thank you all!

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