python macos 控制台_Blender 2.7 MacOS控制台错误

I'm using Blender 2.7 on my mac (OS 10.9.2) and the console won't properly open. If I open blender.app/Contents/MacOS/blender, I get a new terminal window, but it's full of a mix of legible and illegible characters such as "œ˙Ì˛Ä&àÖÄH__PAGEZERO__TEXTÃÃ". No print statements or errors will log there from Blender, either.

Anyone know what's going on?

Thanks!

Edit: I'm also new to terminal and was trying to use "open blender" from the /Contents/MacOS directory :P. If you type "./blender" from the parent directory, it works just fine.

If anyone could shed some light on what's happening or what the difference between typing "./filename" and "open filename" is, that would be awesome.

解决方案

Blender has various resources it needs to run that are located in the same folder as the binary, it starts with the current working directory to find them when you start blender.

In the terminal you are typing commands, there is a sequence (defined in the PATH variable) to where the command is searched for, prefixing the command with ./ is saying to run the command in the current working directory instead of searching through the PATH list for it.

The command open is meant to open editable files in a suitable editor, it would appear that it gets the idea that it can be handled with the terminal, except the new terminal will start in your home directory leaving blender unable to find it's resources. It's been a few years since I used OSX but it may also be trying to run the blender binary as a shell script. Either way open doesn't handle runnable binaries and isn't designed to.

So the difference is that open blender is like saying that you want to edit the file, but ./blender is actually running an application from the command line.

You may also find it fairly easy to create an applescript that tells the terminal to change the working directory and start blender. This can easily be saved as an application you can start from the finder. Which I think would be (untested) -

tell application "Terminal"

do script "cd /Applications/blender/blender.app/Contents/MacOS && ./blender"

end tell

And if all you want is the python output when you run your scripts you may want to try the script here - it lets you run a script in blender's python console to catch the output.

When you want blender specific help with python scripting ask at blender.stackexchange

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值