hplgit / doconce

Lightweight markup language - document once, include anywhere
http://hplgit.github.io/doconce/doc/web/index.html
Other
311 stars 60 forks source link

error in windows 10 #180

Closed phsheth closed 5 years ago

phsheth commented 5 years ago

I get the following error:

(base) C:\Users\Pushkar Sheth>doconce format pdflatex report1
translating doconce text in report1.do.txt to pdflatex
*** error: could not open the file ../model.py used in
@@@CODE ../model.py  fromto: def solver@def u_exact
[Errno 2] No such file or directory: '../model.py'
Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\lib\site-packages\doconce\doconce.py", line 1403, in insert_code_from_file
    codefile = open(filename, 'r')
FileNotFoundError: [Errno 2] No such file or directory: '../model.py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\ProgramData\Anaconda3\Scripts\doconce-script.py", line 1722, in <module>
    bg_session = main()
  File "C:\ProgramData\Anaconda3\Scripts\doconce-script.py", line 1711, in main
    retval = eval(command + '()')
  File "<string>", line 1, in <module>
  File "C:\ProgramData\Anaconda3\Scripts\doconce-script.py", line 102, in format
    bg_session = doconce.doconce.format_driver()
  File "C:\ProgramData\Anaconda3\lib\site-packages\doconce\doconce.py", line 5541, in format_driver
    out_filename, bg_session = file2file(filename_preprocessed, format, basename)
  File "C:\ProgramData\Anaconda3\lib\site-packages\doconce\doconce.py", line 4353, in file2file
    filestr, bg_session = doconce2format(filestr, format)
  File "C:\ProgramData\Anaconda3\lib\site-packages\doconce\doconce.py", line 4556, in doconce2format
    filestr, num_files = insert_code_from_file(filestr, format)
  File "C:\ProgramData\Anaconda3\lib\site-packages\doconce\doconce.py", line 1416, in insert_code_from_file
    errwarn(e)
  File "C:\ProgramData\Anaconda3\lib\site-packages\doconce\doconce.py", line 273, in errwarn
    err.write(msg)
TypeError: write() argument must be str, not FileNotFoundError
phsheth commented 5 years ago

apologies. i think the bit.ly link in the sample code for trials is missing.

phsheth commented 5 years ago

All files present here (except citations bib file): https://github.com/hplgit/hplgit.github.com/tree/master/teamods/writing_reports/doconce_src

KGHustad commented 5 years ago

The second exception shouldn't occur, so that's very much a valid bug.

phsheth commented 5 years ago

The second exception shouldn't occur, so that's very much a valid bug.

The exception goes away after all files are included in the folder. It has generated the tex file. I think some .sty files are missing (ptex2tex.sty). For which i think i need to read this: https://github.com/hplgit/ptex2tex/blob/master/README. Which I will do tomorrow.

phsheth commented 5 years ago

! Package minted Error: You must invoke LaTeX with the -shell-escape flag. ! Package minted Error: You must have `pygmentize' installed to use this package.

! Undefined control sequence. l.404 \bpycod

phsheth commented 5 years ago

Boom! suddenly I have the PDF compiled by texworks Implementation section does not have the code written properly...

phsheth commented 5 years ago

Although DocOnce seems to be working fair - I am having trouble with the minted package. Went around trouble shooting the minted errors online but I am stuck on an error with \inputlistings line not being fed properly. @KGHustad - by any chance do u have an idea how to deal with it?

phsheth commented 5 years ago

I know I am not really helping by pasting all error messages here, but heres the latest:

(base) C:\Users\Pushkar Sheth\Documents\work\doconce_trials\setup4book-doconce-master\doc\src\book>doconce format pdflatex book.do.txt
running preprocess -DFORMAT=pdflatex -DDEVICE=screen  book.do.txt > tmp_preprocess__book.do.txt
Could not run preprocessor:
preprocess -DFORMAT=pdflatex -DDEVICE=screen  book.do.txt > tmp_preprocess__book.do.txt
'preprocess' is not recognized as an internal or external command,
operable program or batch file.

return code from preprocess: 1
Abort! (add --no_abort on the command line to avoid this abortion)
KGHustad commented 5 years ago

Have you installed preprocess in the same conda environment? If not, try conda install -c conda-forge preprocess.

preprocess should show up when you run the following command

conda list preprocess
phsheth commented 5 years ago

I think we are at the last leg of debugging. the report.do.txt is generating, \inputlistings issue is also solved. now to solve preprocess issue.

@KGHustad - do u have a more recent version of the book style format used for recently printed books?

(base) C:\Users\Pushkar Sheth\Documents\work\doconce_trials\setup4book-doconce-master\doc\src\book>conda list preprocess
# packages in environment at C:\ProgramData\Anaconda3:
#
# Name                    Version                   Build  Channel
preprocess                1.2.3                      py_1    conda-forge

(base) C:\Users\Pushkar Sheth\Documents\work\doconce_trials\setup4book-doconce-master\doc\src\book>doconce format pdflatex book.do.txt
running preprocess -DFORMAT=pdflatex -DDEVICE=screen  book.do.txt > tmp_preprocess__book.do.txt
Could not run preprocessor:
preprocess -DFORMAT=pdflatex -DDEVICE=screen  book.do.txt > tmp_preprocess__book.do.txt
'preprocess' is not recognized as an internal or external command,
operable program or batch file.

return code from preprocess: 1
Abort! (add --no_abort on the command line to avoid this abortion)

(base) C:\Users\Pushkar Sheth\Documents\work\doconce_trials\setup4book-doconce-master\doc\src\book>
KGHustad commented 5 years ago

The issue is that Windows does not seem to recognise preprocess as a command even though it should be present in the environment. Could you try running preprocess or preprocess.exe in the Anaconda command prompt? I don't know if I have ever tested preprocess on Windows, but I wasn't expecting it to cause any problems.

The book style format has not changed in the past couple of years. I know it could probably use an update, but I don't have the time to do that anytime soon.

phsheth commented 5 years ago

I appreciate your help @KGHustad. Closing this issue here because it is external to doconce.