2/13/2023 0 Comments Maya python ls ignore namespaceOutput: The script path is : /home/main.py MCQ Practice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews. For that, we will use the special variable called _file_ and pass it to realpath() method of the os.path module. Now let’s look at how to get the script path regardless of where you are running it. Output: Path of the current directory : /home To do this, we start by grabbing the name of the root animation layer: baseAnimationLayer cmds.animLayer( query True, root True) Copy. Print("Name of the current directory : " + repn) The first thing that we want to do is to find out if there is already an animation layer with the given name present in the scene. Print("Path of the current directory : " + path) If you just want the name of the directory, you can either separate it with “/” or use another function called “basename” from the “os.path” module.īelow is the code that returns the absolute path of the current directory and its name. It returns the full(absolute) path of the current working directory. It has a method called getcwd() which will return the current directory. To perform this task, we will use the “os” module in Python. How to get the path of the current directory in Python The current directory is nothing else than the folder from where your script is executed. In this tutorial, we are going to see how to get the path of the current directory in Python.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |