Getting Directory of Command Line Entry Point For Packages

David L Neil DomainAdmin at DancesWithMice.info
Fri Nov 12 17:02:55 EST 2021


On 13/11/2021 10.51, Abdur-Rahmaan Janhangeer wrote:
> Greetings list,
> 
> Let's say i created a package named miaw
> 
> miaw also has a cli command called miaw
> 
> miaw prints files and folders in the directory it is called in
> 
> except that when miaw is used, it prints the files and folders in
> site-packages
> 
> This is an analogy for  a package i have.
> 
> Well forgetting about the lines above, how do i get the path from
> which miaw the command is called from?

try:

file_path = __file__
print( file_path )

and process file_path as-required.
-- 
Regards =dn


More information about the Python-list mailing list