0
Не ошибка

Sublime crashes after executing command which uses applescript to interact with it

Philipp Brumm 12 лет назад обновлен Jon Skinner 12 лет назад 0
Doing this in the console

import commands
commands.getoutput("osascript -e 'tell app \"Sublime Text 2\" to choose color'")

results in Sublime freezing and needing to be force-quit.

Ответ

Ответ
Не ошибка
The command you're entering blocks the main thread while awaiting a reply from the main thread of the current process. By definition, this can't work.

In general, as commands entered via the console are run in the main thread of the Sublime Text process, there are many ways to cause harm to the process. The only alternative would be to run a sandboxed version of Python that couldn't interact with the system, which would not be desirable.

The above aside, you may be able to get the desired result running the command via a thread in a plugin. However, due to the way the Python Global Interpreter Lock works, I can't guarantee this will work without trying it.
Ответ
Не ошибка
The command you're entering blocks the main thread while awaiting a reply from the main thread of the current process. By definition, this can't work.

In general, as commands entered via the console are run in the main thread of the Sublime Text process, there are many ways to cause harm to the process. The only alternative would be to run a sandboxed version of Python that couldn't interact with the system, which would not be desirable.

The above aside, you may be able to get the desired result running the command via a thread in a plugin. However, due to the way the Python Global Interpreter Lock works, I can't guarantee this will work without trying it.

Сервис поддержки клиентов работает на платформе UserEcho