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

Cannot generate example - messed up path? #79

Closed
py9mrg opened this issue May 26, 2020 · 8 comments
Closed

Cannot generate example - messed up path? #79

py9mrg opened this issue May 26, 2020 · 8 comments

Comments

@py9mrg
Copy link

py9mrg commented May 26, 2020

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
Copy link
Author

py9mrg commented Oct 12, 2021

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
Copy link
Contributor

wescpy commented Aug 28, 2023

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
Copy link
Author

py9mrg commented Aug 29, 2023

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
Copy link
Contributor

wescpy commented Aug 29, 2023

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
Copy link
Author

py9mrg commented Aug 29, 2023

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.

  • Create (or reuse) a developer project at https://console.developers.google.com
    • clicked create_project then modified the name to md2gslides, clicked create.
  • Enable Google Slides API at API library page
    • searched for "slides", clicked enable (new md2gslides project selected in dropdown box at top left of window), took me to a new page (originally clicked create credentials here and followed through to the OAuth option but I assume this is the same but to be sure, this time I'm closing the window and using your link)
  • Go to Credentials page and click "+ Create credentials" at the top - done
  • Create "OAuth client ID" type of credentials. - done
  • Choose type "Computer Application" and give it some name.
    • Chose the option "Desktop App" because there is no "Computer application" option and this seems most similar. Should I try "web application" instead?
    • Changed name to md2gslides, clicked create
    • Pop up window where I can download credentialXXX.json
  • Download client ID/secret file and shorten the name to: client_id.json.
    • downloaded file to C:\\Users\me\.md2googleslides\ and renamed to client_id.json.
  • Move client_id.json (name has to be exact) to ~/.md2googleslides.

Then...

  • Try to run the example (cloned repos, navigated to /examples and ran md2gslides example.md).
  • Got the same error as above

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
Copy link
Contributor

wescpy commented Aug 29, 2023

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
Copy link
Author

py9mrg commented Aug 30, 2023

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
Copy link
Author

py9mrg commented Sep 19, 2023

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

@py9mrg py9mrg closed this as completed Sep 19, 2023
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