googleworkspace / md2googleslides

Generate Google Slides from markdown
Apache License 2.0
4.48k stars 284 forks source link

Cannot generate example - messed up path? #79

Closed py9mrg closed 1 year ago

py9mrg commented 4 years ago

When trying to run md2gslides on a cloned copy of the example slide, I get the following error:

C:\Data\GitHub\md2googleslides\examples>md2gslides example.md
Unable to generate slides: [Error: ENOENT: no such file or directory, open 'C:\C:\Data\GitHub\md2googleslides\examples\image_slide.png'] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'open',
  path: 'C:\\C:\\Data\\GitHub\\md2googleslides\\examples\\image_slide.png'
}

image_slide.png is definitely in the correct folder so I presume the problem is the additional C:\\ appended to the path - how do I prevent md2gslides from doing that? I tried specifying the full path in the example.md, but that doesn't help.

py9mrg commented 3 years ago

Been trying this again and tried a variety of fixes (e.g. try <a href = "absolute path">blah</a>, [](file://absolute path), and many variations) but none worked. Also noticed the problem arises on the example slides that generate local images - e.g. the SVG and MathJaX slides. Must be something with the way local paths are resolved by md2gslides.js on Windows.

I should add - I can get rid of the above error if I do use something like [](file://absolute path) or even [](file://filename) but all I get in the slide is that literal text, not the actual image. That's with or without the --use-fileio option.

wescpy commented 1 year ago

This is the same bug as </issues/61>, so this should be marked as a duplicate of that one, which will also link to your useful comment above. By the way, what happens when you have plain ol' Markdown like: ![](image_slide.png)?

py9mrg commented 1 year ago

Just had a trial - did it completely from scratch (deleted all old credentials etc) but got the following error:

image

I think this might be related to a warning I got when generating the new project and credentials that it might take a few hours so will try again later.

wescpy commented 1 year ago

Thanks for the error msg. When you try again, can you outline your exact steps in more detail? I'm esp. curious about generating client credentials and what you do with them. Really try to follow these steps as verbatim as possible. Note that email addresses of the Cloud project must be the same as the user running the script. Don't mix work, test, or personal accounts.

I also may be missing a step or 2, so that's why I need to know. I'm going to link to a intro to Workspace APIs tutorial. The tutorial is in Python (my main development tool), and that API used is the Drive API, but those aren't important here... getting authorization to use the Slides API is the same as the Drive API. The bulleted instructions should match all the steps outlined in module 7 (Authorize API requests (user authorization) so make sure I didn't miss anything. In particular, you have to fill out an "OAuth consent screen" which aren't in my instructions (yet), so see if this page helps.

py9mrg commented 1 year ago

Strange, I have the same error. I tried to follow the instructions step by step as best I can, bearing in mind some things in Google have changed. I'll do them again now here so you can see. I am using my personal account only for this.

First, delete everything, all projects, credentials, everything, then, below are the current steps in the readme plus any comments from me.

Then...

I notice in Google's documentation you linked this page, which using your method doesn't present the section about OAuth Consent (the part where you click Internal or External. I have managed to do this by going to the relevant section (you can only click external and you can ignore nearly everything except the title and adding your email):

image

BUT, on one of my tries it did present this screen to me automatically when I clicked Create credentials but it wasn't from your link, or the original one I tried, and I have fiddled so much I can't remember where exactly I clicked that to get it! I can delete everything AGAIN (!!) and see if I can force it, but the section in the image above should work as well.

Once I completed that I still have the error. BUT, if I go back to that section I notice there's a button Publish, which I have now clicked on and the page now shows:

image

The error has now goes away. Except I now get this:

image

I click advanced and then click the continue anyway button. It finally takes me to the consent screen and I can authorise. Phew!!

The only issue now is the path issue as per this issue. To answer the above question, ![](image_slide.png) doesn't work (the example is already written that way). Further, I can't seem to make the hack work. The only place I can find the code is in md2gslides\lib\images\probe.js.map but changing it here as mentioned in the other issue doesn't help. Albeit, I realise I know zero about js/ts so it might not be that simple to do it post ts -> js compilation.

wescpy commented 1 year ago

You're definitely in a better place now. I think last time you clicked "external" app (instead of "internal") for the OAuth consent screen. I should add a bullet for that to the README.

Unfortunately I've got a medical procedure coming up and won't be able to look at the filepath issue until I get back. However, if you know anyone with Node.js skills who could do it, I'm happy to look at PRs. I just don't have the expertise to do it quickly. (This should be some sort-of known problem in the Node.js ecosystem though... I'd be surprised if there isn't a solution out there already.)

py9mrg commented 1 year ago

Oh, I mean both times I selected external because the internal option is ghosted. I forget the message why, something to do with organisation maybe (I had to choose No Organisation for my project).

The key to get it working was to click the publish button in the OAuth consent section. Although I guess leaving it as testing and entering my own email in the authorised testers section towards the bottom might have helped.

Don't worry about the other thing. I'll keep trying to work it out when I have the time and might ask the person who fixed it exactly what they did over on their issue. Hope the procedure goes well (and that it's nothing too serious).

If I have the chance, I'll try to do a PR to update the readme installation instructions but it might take some time as I'll have to delete everything and run through a few times to be confident exactly what steps are essential. I think there might need to be an "If your project has to be under No Organisation" section do ...

But I can't check what has to be done for the case where you can put your project under an organisation (which is presumably where "Internal" would work) because my company doesn't allow it. At least not with an arduous back and forth with IT that I expect they will rule out.

Good luck, again.

py9mrg commented 1 year ago

Solved for Windows users with manual modification of installed code. See #61.