2016年9月7日 星期三

[MAC][IDE][ATOM] build python3.4 on atom editor

1.download and installed the atom in mac as usual way.

2.download the package atom-runner
(from the atom menu->preference->install...)
ref:https://github.com/lsegal/atom-runner
3.go to atom->config

you will open below setting, and add the red line into it. (careful with indent.)

"*":
  "atom-runner": {}
  core:
    automaticallyUpdate: false
    destroyEmptyPanes: false
    openEmptyEditorOnStart: false
    themes: [
      "one-dark-ui"
      "atom-dark-syntax"
    ]
  editor:
    fontSize: 18
    invisibles: {}
    showIndentGuide: true
    showInvisibles: true
    zoomFontWhenCtrlScrolling: true
  "exception-reporting":
    userId: "d4912b62-aa97-a2d1-4abc-b19393b94058"
  runner:
    scopes:
      python: "/Library/Frameworks/Python.framework/Versions/3.4/bin/python3"
  welcome:
    showOnStartup: false



4. you can change the keymap if you want.

2016年9月2日 星期五

[rubyonrails] call out python

This method is not running command in background.


put your test.py under
/app/assets/pythonscripts/test.py

import os, sys
import time

time.sleep(5)
print("python in rails ha ha 5  ")




in show.html.erb

<% cmd = "python3.4 "+ "#{Rails.root}/app/assets/pythonscripts/test.py" %>
<% result = %x[#{cmd} &] %>
<%= result %>