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

another crash #64

Open
kohlhase opened this issue Dec 1, 2024 · 2 comments
Open

another crash #64

kohlhase opened this issue Dec 1, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@kohlhase
Copy link
Collaborator

kohlhase commented Dec 1, 2024

I get the following on MathHub/courses/AI/problems/csp/quiz/:


 | File 12/35      | Annotations added: 34     |
                                                                                                     csp1.en.tex                                                                                                      
  27     %\item Class 4 - Natural Language Processing: on Monday 10:00am-11:00pm and Thursday on 1:00pm-2:00pm
  28     %\item Class 5 - Advanced Data Structrues \& Algorithms: on Thursday 2:00pm-3:00pm and Friday 1:00pm-2:00pm
  29     % \item Class 6 - Advnaced Linear Algebra: on Monday 11:00am-12:00pm Tuesday 2:00-3:00pm
  30   %\end{itemize}
  31 
  32   A new \sn{semester} begins and you, as a \sn{student}, want to prepare your schedule by assiging
  33   \sr{lecture}{classes} to \sns{mod?calendar?day} of the \sn{mod?calendar?week}.  Your university week is from Monday to Friday (Monday,
  34   Tuesday, Wednesday, Thursday, Friday).  You have 3 classes: Programming, Linear Algebra,
  35   and Artificial Intelligence.
  36 
  37   However, you do not like to attend a Linear Algebra class on Fridays or Mondays because
  38   you are usually not in the mood for math.  Additionally, you need to go work an 8 hour
  39   shift on Tuesday and taking a programming class on this day would be too much of a

                                                                                                    Import options                                                                                                    
The symbol is not in scope.
\importmodule is impossible: not in an smodule

Commands:
  [h]elp
  [q]uit subdialog
  [u]semodule after \begin{sproblem}
  [t]op-level usemodule (i.e. after \begin{document})
>>> u
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/Users/kohlhase/vc/git/github.com/sLaTeX/stextools/stextools/__main__.py", line 103, in <module>
    cli()
    ~~~^^
  File "/Users/kohlhase/vc/git/github.com/sLaTeX/stextools/.venv/lib/python3.13/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/Users/kohlhase/vc/git/github.com/sLaTeX/stextools/.venv/lib/python3.13/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/Users/kohlhase/vc/git/github.com/sLaTeX/stextools/.venv/lib/python3.13/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/Users/kohlhase/vc/git/github.com/sLaTeX/stextools/.venv/lib/python3.13/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kohlhase/vc/git/github.com/sLaTeX/stextools/.venv/lib/python3.13/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/kohlhase/vc/git/github.com/sLaTeX/stextools/stextools/__main__.py", line 99, in snify_actual
    snify(files, filter, ignore)
    ~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kohlhase/vc/git/github.com/sLaTeX/stextools/stextools/snify/controller.py", line 493, in snify
    unfinished = controller.run()
  File "/Users/kohlhase/vc/git/github.com/sLaTeX/stextools/stextools/snify/controller.py", line 236, in run
    if not self.ensure_cursor_selection():
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/kohlhase/vc/git/github.com/sLaTeX/stextools/stextools/snify/controller.py", line 401, in ensure_cursor_selection
    selection_cursor = self.find_next_selection()
  File "/Users/kohlhase/vc/git/github.com/sLaTeX/stextools/stextools/snify/controller.py", line 427, in find_next_selection
    if not file_from_path(self.state.get_current_file(), self.linker):
                                                         ^^^^^^^^^^^
  File "/Users/kohlhase/vc/git/github.com/sLaTeX/stextools/stextools/snify/controller.py", line 218, in linker
    self._linker = Linker(self.mh)
                   ~~~~~~^^^^^^^^^
  File "/Users/kohlhase/vc/git/github.com/sLaTeX/stextools/stextools/core/linker.py", line 81, in __init__
    self._compute_dep_graph()
    ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/kohlhase/vc/git/github.com/sLaTeX/stextools/stextools/core/linker.py", line 147, in _compute_dep_graph
    process_dep(dep, doc)
    ~~~~~~~~~~~^^^^^^^^^^
  File "/Users/kohlhase/vc/git/github.com/sLaTeX/stextools/stextools/core/linker.py", line 127, in process_dep
    dep_doc, dep_mod = dep.get_target(mh, src_doc)
                       ~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/Users/kohlhase/vc/git/github.com/sLaTeX/stextools/stextools/core/stexdoc.py", line 109, in get_target
    doc = self.get_target_stexdoc(mh, src)
  File "/Users/kohlhase/vc/git/github.com/sLaTeX/stextools/stextools/core/stexdoc.py", line 94, in get_target_stexdoc
    path = self.get_target_path(mh, src)
  File "/Users/kohlhase/vc/git/github.com/sLaTeX/stextools/stextools/core/stexdoc.py", line 53, in get_target_path
    if r := archive.resolve_path_ref(self.file_hint + '/' + self.module_name, 'lib' if self.is_lib else 'source', di.lang):
            ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kohlhase/vc/git/github.com/sLaTeX/stextools/stextools/core/mathhub.py", line 220, in resolve_path_ref
    if p1.is_file():
       ~~~~~~~~~~^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/pathlib/_abc.py", line 482, in is_file
    return S_ISREG(self.stat(follow_symlinks=follow_symlinks).st_mode)
                   ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.13/3.13.0_1/Frameworks/Python.framework/Versions/3.13/lib/python3.13/pathlib/_local.py", line 515, in stat
    return os.stat(self, follow_symlinks=follow_symlinks)
           ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 63] File name too long: "/Users/kohlhase/localmh/MathHub/smglom/education/source/mod/lecture\\usemodule[courses/FAU/AI/course]{csp/slides?csp-intro}\n  \\usemodule[courses/FAU/AI/course]{csp/slides?csnet-formal}\n  \\objective{understand}{CSP}\n  \\objective{apply}{CSP}\n  %\n\n  %A new semester begins and you, as a student, want to prepare your schedule by assiging class to days of the week.\n  %Your university week is from Monday to Friday (Monday, Tuesday, Wednesday, Thursday, Friday).  \n  %However, you also wish to have a social life so you do not want to attend any classes on Friday after 2:00pm. \n  %Additionally, you need to go work an 8 hour shift on Monday at 1:00pm and Thursday at 4:00pm. \n  %Thus, you can only attend classes until 12:00pm on Monday and 3:00pm on Thursday. \n  %You also don't like having running slots (attending 2 consectutive slots after each other). \n  %Naturally, you cannot attend two classes at the same time.\n\n  %\\begin{itemize}\n    %\\item Class 1 - Artificial Intelligence I: on Monday 8:00-10:00am and Wednesday 1:00pm-2:00pm\n    %\\item Class 2 - Knowledge Representation \\& Processing: on Tuesday 10:00-11:00am\n    %\\item Class 3 - Computer Vision: on Tuesday 8:00-10:00am\n    %\\item Class 4 - Natural Language Processing: on Monday 10:00am-11:00pm and Thursday on 1:00pm-2:00pm\n    %\\item Class 5 - Advanced Data Structrues \\& Algorithms: on Thursday 2:00pm-3:00pm and Friday 1:00pm-2:00pm\n    % \\item Class 6 - Advnaced Linear Algebra: on Monday 11:00am-12:00pm Tuesday 2:00-3:00pm\n  %\\end{itemize}\n\n  A new \\sn{semester} begins and you, as a \\sn{student}, want to prepare your schedule by assiging\n  \\sr{lecture}{classes} to \\sns{mod?calendar?day} of the \\sn{mod?calendar?week}.  Your \\sn{university} week is from Monday to Friday (Monday,\n  Tuesday, Wednesday, Thursday, Friday).  You have 3 classes: Programming, Linear Algebra,\n  and Artificial Intelligence.\n\n  However, you do not like to attend a Linear Algebra class on Fridays or Mondays because\n  you are usually not in the mood for math.  Additionally, you need to go work an 8 hour\n  shift on Tuesday and taking a programming class on this day would be too much of a\n  headache.  Thus, you do not want to attend any programming classes on Tuesday as it is\n  too much trouble otherwise.  You also don't like attend the same class for two\n  consectutive days as this tires you out.  Assume you take one class per day.\n\n  The above classes are offered for you on these days:\n  \\begin{itemize}\n  \\item Programming: Monday, Tuesday, Thursday\n  \\item Linear Algebra: Monday, Tuesday, Wednesday, Friday\n  \\item Artificial Intelligence: Tuesday, Wednesday, Thursday, Friday\n  \\end{itemize}\n  \n  If we formulate the above problem as a \\sr{CSP}{Constraint Satisfaction Problem}\n  (\\sn{CSP}), which of the following would be the set of \\sr{variable}{variables} used and\n  their \\sr{variable?domain}{domains}?  We abbreviate the names of classes as: $P$, $L$,\n  $A$.  Additionally, we abbreviate the days of the week as ${M, T, W, Th, F}$\n\n  \\begin{scb}\n    \\scc{\n      \\begin{tabular}{l|r}\n        \\textbf{Variables} & \\textbf{Domains}\\\\\\hline\n        $P$ & M, T, Th\\\\\n        $L$ & M, T, W, F\\\\\n        $A$ & T, W, Th, F\\\\\n      \\end{tabular}}\n    \\scc[T]{\n      \\begin{tabular}{l|r}\n        \\textbf{Variables} & \\textbf{Domains}\\\\\\hline\n        M & $P, L$\\\\\n        T & $P, L, A$\\\\\n        W & $L, A$\\\\\n        Th & $P, A$\\\\\n        F & $L, A$\\\\\n      \\end{tabular}\n    }\n    \\scc{None of the above.}\n  \\end{scb}\n  \n  Which set of the following \\sr{CSP}{constraints} (implicit or explicit) is correct for\n  the above problem?  Please bear in mind that there is more than one represntation for\n  the constraints depending on the language used.\n  \\begin{mcb}\n    \\mcc[T]{$M \\neq T$, $T \\neq W$, $W \\neq Th$, $Th \\neq F$, $M = \\bsetst{d}{d}{d \\neq L}$, $T =\n      \\bsetst{d}{d}{d \\neq P}$, $F = \\bsetst{d}{d}{d \\neq L}$} \n    \\mcc{$W \\neq Th$ $M = \\bsetst{d}{d}{d \\neq L}$, $T = \\bsetst{d}{d}{d \\neq P}$, $F =\n      \\bsetst{d}{d}{d \\neq L}$} \n    \\mcc[T]{$M = \\bsetst{d}{d}{d \\neq L}$, $T = \\bsetst{d}{d \\neq P}$, $F =\n      \\bsetst{d}{d}{d \\neq L}$, $C_{v_{i}, v_{i+1}| i \\in weekdays} =\n      \\bsetst{d,d'}{\\inset{\\pair{d}{d'}}{\\cart{D,D}}}{d \\neq d'}$, where $i$, $i+1$ are two\n      consecutive week days} \n    \\mcc{$M \\neq T$, $T \\neq W$, $W \\neq Th$, $Th \\neq F$,\n      $C_{v_{i}, v_{i+1}| i \\in weekdays} =\n      \\bsetst{d,d'}{\\inset{\\pair{d}{d'}}{\\cart{D,D}}}{d \\neq d'}$, where $i$, $i+1$ are two\n      consecutive week days}\n  \\end{mcb}\n\\end{sproblem}\n\\end{document}\n% srskip l:begins, l:schedule"
kohlhase@faui8-pool2 quiz % 
@kohlhase kohlhase added the bug Something isn't working label Dec 1, 2024
@kohlhase
Copy link
Collaborator Author

kohlhase commented Dec 1, 2024

Apparently, snify created

 \usemodule[smglom/education]{mod?lecture\usemodule[courses/FAU/AI/course]{csp/slides?csp-intro}

earlier.

@jfschaefer
Copy link
Collaborator

I've fixed it so that snify won't crash from this anymore and instead warn the user.
I'm not yet sure how to reproduce the wrongly created usemodule...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants