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

write file to specified path #41

Closed
mika-long opened this issue Jul 19, 2020 · 3 comments
Closed

write file to specified path #41

mika-long opened this issue Jul 19, 2020 · 3 comments

Comments

@mika-long
Copy link

Currently, create_md_file() only allows us to write to the current folder where the python script is in.

Is there anyway to add additional functionality by allowing the user to pass in a path in maybe another folder? And have the output directed to that path instead.

Thx.

@mika-long
Copy link
Author

mika-long commented Jul 19, 2020

Welp this was a really dumb question since I think one can change the filename to make things work.
Sorry about the trouble!

@apgapg
Copy link

apgapg commented Mar 14, 2021

@mika-long I tried sepcifying path to file name like
mdFile = MdUtils(file_name='../docs/src/guide/courses/ray_optics.md',title='Ray Optics')
but this throws error
FileNotFoundError: [Errno 2] No such file or directory: '../docs/src/guide/courses/ray_optics.md'

@apgapg
Copy link

apgapg commented Mar 14, 2021

No worries I found a way:

dirname = os.path.dirname(__file__)
filename = os.path.join(dirname, '../docs/src/guide/courses/ray-optics.md')

mdFile = MdUtils(file_name=filename)
mdFile.create_md_file()

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