<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2017-07-18 15:56 GMT+02:00 Nick Coghlan <span dir="ltr"><<a href="mailto:ncoghlan@gmail.com" target="_blank">ncoghlan@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">On 18 July 2017 at 22:08, George Fischhof <<a href="mailto:george@fischhof.hu">george@fischhof.hu</a>> wrote:<br>
> Hi there,<br>
><br>
> I created a program which uses plugins (import them). I started to test it,<br>
> and found that I need two types of paths: one for file system and another<br>
> one which is package relative.<br>
><br>
> So I thing this is a good idea, to enhance pathlib to handle package roots.<br>
<br>
</span>Is there a specific behaviour you're looking for that isn't already<br>
addressed by "pathlib.Path(module.__file__)<wbr>.parent"?<br>
<br>
Cheers,<br>
Nick.<br>
<span class="gmail-HOEnZb"><font color="#888888"><br>
--<br>
Nick Coghlan   |   <a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a>   |   Brisbane, Australia<br>
</font></span></blockquote></div><br><br></div><div class="gmail_extra">Hi Nick,<br><br></div><div class="gmail_extra">I think yes ;-) <br></div><div class="gmail_extra">I would like to use (or I think it would be good to use) something like <br></div><div class="gmail_extra">pathlib.Path(package_root)<br></div><div class="gmail_extra">so I could use <br><br>importlib.import_module(pathlib.Path(package_root) / plugins / plugin_name)<br></div><div class="gmail_extra"><br>and normal file system operations (for example)<br></div><div class="gmail_extra"><br>with open(pathlib.Path(package_root) / plugins / plugin_name) as my_file:<br></div><div class="gmail_extra">    do_something_with_file<br><br><br></div><div class="gmail_extra">Import statement can be used to go downward and path can be used up and down in the directory hierarchy. If someone wants to use both of them, the only common point (branch) is the package root. From the package root one can use the same path expressions for import and for other file system operations.<br><br><br></div><div class="gmail_extra">BR,<br></div><div class="gmail_extra">George<br></div></div>