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

PDF build fails with IOError on OSX #12

Open
cansik opened this issue Jul 28, 2015 · 1 comment
Open

PDF build fails with IOError on OSX #12

cansik opened this issue Jul 28, 2015 · 1 comment

Comments

@cansik
Copy link

cansik commented Jul 28, 2015

I tried to create the pdf but make does always fail with this error:

Error

Traceback (most recent call last):
  File "src/parseBook.py", line 49, in <module>
    modifiedChapterString = injectShaderBlocks(folder,modifiedChapterString)
  File "src/parseBook.py", line 26, in injectShaderBlocks
    shaderString = open(shaderPath, 'r').read()
IOError: [Errno 2] No such file or directory: './14/texture.frag" data-imgs="hokusai.jpg'
make: *** [all] Error 1

Research

It looks like the script takes a bit too much from the html. In this case it would be a parsing error, so i checked your regex:

shaderFile = re.sub(r'<div class=\"codeAndCanvas\" data=\"(.*)\"></div>', r'\1', line.rstrip())

This regex should filter out the .frag in this line:

<div class="codeAndCanvas" data="texture-resolution.frag" data-imgs="nicephore.jpg"></div>

Problem

Now the problem is:

  1. There is an unescaped / at the end of the query.
  2. The (.*) is too greedy. It does not care about other attributes in the html div.

So the result of the first group is:
texture-resolution.frag" data-imgs="nicephore.jpg

Fix

We could try make a stronger regex if we know how the files are named. They just contain -, A-Za-z, . and end with a frag so why don't we just try to match them and leave everything else away?

data=\"([\w\-\.]+frag)\"

Now we can replace the line in the script with a simple regex search and get the filename in the first group value:

shaderFile = re.findall('data=\"([\w\-\.]+frag)\"', line)[0]

Finally it works!...ehm...the generation of the frag's works. I have a .tex file now, but the pdf generation still does not work. If I find the solution I will open another issue.

As a help for other Mac users want to build it themselfs

If you try to make the glslViewer on MacOSX and it does not find the glfw3 library, you have to export the path to it after install (maybe the path is different on your system):
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/

And you have to install xelatex!

@cansik cansik changed the title PDF build fails with IOError PDF build fails with IOError on MacOSX Jul 28, 2015
@cansik cansik changed the title PDF build fails with IOError on MacOSX PDF build fails with IOError on OSX Jul 28, 2015
@yvan-sraka
Copy link
Contributor

Ok, so @cansik, as I suggested, I create this PR: #155, so I think we can close this issue too 😉!

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

2 participants