mbakeranalecta / sam

Semantic Authoring Markdown
Other
79 stars 8 forks source link

Fixups to get it to run on Linux #200

Open 0x8000-0000 opened 4 years ago

0x8000-0000 commented 4 years ago

Tested with Python 3.6.9 on Ubuntu 18.04 .

mbakeranalecta commented 4 years ago

Hi Florin,

Thanks for the interest in the SAM project and for offering these changes. I have not worked on the project, or done any Python programming at all for quite a while now. Can you talk me through the I/O changes you have made? Why are they needed and what effects do they have. Also, have you tested them on Windows?

0x8000-0000 commented 4 years ago

Hi Florin,

Thanks for the interest in the SAM project and for offering these changes. I have not worked on the project, or done any Python programming at all for quite a while now. Can you talk me through the I/O changes you have made? Why are they needed and what effects do they have. Also, have you tested them on Windows?

Hi Mark,

First of all, thank you for an interesting tool and perspective on document preparation.

This is what happens when I run the current master branch on Windows using Python3.7.3 from Anaconda:

>\Apps\Anaconda3\python.exe samparser.py regurgitate test1.sam

SAM parser information: Parsing C:\Users\fiucha\source\libraries\sam\test1.sam
SAM parser information: Parsing include file:///C:/Users/fiucha/source/libraries/sam/includeme.sam
SAM parser information: Finished parsing include includeme.sam
SAM parser information: Parsing include file:///C:/Users/fiucha/source/libraries/sam/includeme1.sam
SAM parser information: Parsing include file:///C:/Users/fiucha/source/libraries/sam/includeme2.sam
SAM parser information: Finished parsing include includeme2.sam
SAM parser information: Finished parsing include includeme1.sam
SAM parser warning: Unannotated phrase found: {should be reported} If you are trying to insert curly braces into the document, use \{should be reported}.
SAM parser warning: Unannotated phrase found: {bold} If you are trying to insert curly braces into the document, use \{bold}.
SAM parser warning: Unannotated phrase found: {code} If you are trying to insert curly braces into the document, use \{code}.
Traceback (most recent call last):
  File "samparser.py", line 3825, in <module>
    args.func()
  File "samparser.py", line 3754, in regurgitate_output
    write_output(inputfile, '.sam', samParser.doc.regurgitate, mode='text')
  File "samparser.py", line 3651, in write_output
    sys.stdout.buffer.write(i)
TypeError: a bytes-like object is required, not 'str'

With my change, I can get regurgitate plus the XML/HTML output.

mbakeranalecta commented 4 years ago

Ah, so it looks like I managed to introduce some bug into the regurgitate code and evidently did not test it properly. I will take a look as soon as I can.