在realflow里有个Open Project Folder ...命令用来打开工程项目的目录窗口,我在使用maya的时候我也经常打开maya的工程项目,为什么不把这个简单的功能移植过来呢?
so let's do it.
我google了一下,发现在python中有几种方法来打开指定路径的文件夹
1.使用os.system方法
import os
os.system('explorer "c:\myMayaProject"')
这时会弹出一个cmd.exe窗口来执行我们的命令,然后我们的窗口在所有的窗口的最前面
2.使用os.startfile方法
import os
os.startfile('explorer "c:\myMayaProject"')
不会弹出一个cmd.exe窗口,然后我们的窗口在其它的窗口的后面
3.使用subprocess.Popen方法
import subprocess
subprocess.Popen('explorer "c:\myMayaProject"')
不会弹出一个cmd.exe窗口,然后我们的窗口在所有的窗口的最前面
要用哪个方法就看需要了,这里使用第三个
def openProjectFolder():
import os, subprocess
import sys
# get project folder's path
# 获取工程项目的路径
sceneFile = mc.workspace( q=1, dir=1)
if not os.path.exists(sceneFile):
sys.stderr.write( "No path to open a folder.\n" )
raise
sceneFile = os.path.normcase(sceneFile)
subprocess.Popen('explorer "%s"' % sceneFile)
我个人比较喜欢先开场景的目录窗口,所以我用的是
def openSceneFolder():
import os, subprocess
import sys
# get Scene file folder's path
# 获取当前场景的路径
sceneFile = os.path.dirname(mc.file( q=1, sn=1 ))
if not sceneFile: # 如果不存在当前场景的路径
# get project folder's path
# 获取工程项目的路径
sceneFile = mc.workspace( q=1, dir=1)
if not os.path.exists(sceneFile):
sys.stderr.write( "No path to open a folder.\n" )
raise
sceneFile = os.path.normcase(sceneFile)
subprocess.Popen('explorer "%s"' % sceneFile)
分享到:
相关推荐
相比VS2010及 VS2012, VC6编译器缺少一个“Open Containing Folder”的功能。该插件(MyOWF.dll)实现了该功能。 使用方法:1)将MyOWF.dll放到C:\Program Files (x86)\Microsoft Visual Studio\Common\MSDev98\Add...
语言:English,日本語 从Chrome在资源管理器中打开本地文件夹 从Chrome的上下文菜单中的资源管理器中打开一个本地文件夹。 *高级[原因]-需要注册表更改-需要Node.js
| Open project folder | f10 [cursor]| OpenPath: Open project folder | | Open file folder | ctrl+f10 [cursor]| OpenPath: Open file folder | # after | Open project folder | f10 [cursor]| OpenPath: Open ...
这是我找到的一个killer级工具,安装后会在资源管理器右键菜单中添加Open Command Prompt Here... 对于经常需要在指定目录下打开命令行窗口的开发员来说,这个工具简直是必备品。 用过就知道有多好了。
Python笔记PythonPython笔记笔Python笔Python笔记记记Python笔记
使用时通过命令行运行,python main.py folder_path 后面路径中存放的是一些jpg图片和一个avi视频,会自动处理成一个新视频,并添加特效。
Using Unity 2020 (XR plug-ins, URP) and Normcore (networking, voice chat) to build multiplayer ...Open the Unity Project folder inside this repository folder Open Build Settings, set to Android
files in the General directory to your project folder or some appropriate general folder you want. 2) Include the clause "uses NativeXml" in your unit. If you want to use NativeXml in all your ...
Android 实现iphone主屏幕文件夹展开合并效果(OpenFolder)
python库,解压后可用。 资源全名:split_folder-0.1.0-py3-none-any.whl
用python写代码删除文件, 记得输入pyinstaller -F -w delete_folder11_all_files.py 就可以生成exe执行文件了。 用python写代码删除文件, 记得输入pyinstaller -F -w delete_folder11_all_files.py 就可以生成exe...
fail_to_use_service_name_to_access_share_folder_in_Win2008_cluster
# 创建所有文件夹 for folder_name in folder_names: os.makedirs(folder_name) # 创建.zip文件 with zipfile.ZipFile(zip_name, 'w') as zipf: for folder_name in folder_names: # 将每个文件夹添加到.zip文件中
Atom-atom-project-folder.zip,快速添加/删除项目文件夹项目文件夹,atom是一个用web技术构建的开源文本编辑器。
1.适用于使用Python语言操作可视化界面,鼠标键盘事件的场景; 2.免费开源,不需要积分就可以下载; 3.资源丰富,包括了TagUi,下载后简单调式就可以直接使用;
Click "Open Theme Folder" button from `Preference Panel` → `Appearance` section. Put downloaded content into the opened folder, make sure your css files are directly under that directory.
所有代码都是用Python 3编写的,并使用OpenAI Gym的RL环境。高级技术使用Tensorflow实现神经网络。 This repository provides code, exercises and solutions for popular Reinforcement Learning algorithms. ...
一个添加菜单以打开包含文件夹的插件 描述 它是Sakura Editor的插件,其中添加了“打开包含文件夹”菜单。执行后,将在资源管理器中打开包含当前打开文件的文件夹。需要使用Sakura Editor(UNICODE... +-- open_folder
资源分类:Python库 所属语言:Python 使用前提:需要解压 资源全名:cloudtoken-0.1.43-py3-none-any.whl 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
To add gradle dependency you need to open build.gradle (in your app folder,not in a project folder) then copy and add the dependencies there in the dependencies block; 2.Add TvRecyclerView in your ...