MAC Python IDE

unhandled

#1

Hi Guys,

I think this topic belongs to the Mac forum. I wonder if there is a nice solution for pythoneers on the Mac? Shouldn’t the new XCode work? (I haven’t done any Mac programming since I switched to MS just for Rhino.)

Thanks for any hints.
Jess


#2

Well I do some simple python on OSX. Here at work I use

Vico - http://www.vicoapp.com
At Home, Chocolat - https://chocolatapp.com

I used to use Komodo Edit - http://komodoide.com/komodo-edit/

I hope this helps,
Randy


#3

Just trying Vico again and new build seems buggy.

Trying Atom - https://atom.io

OSX only though.


#4

Hi Randy,

thanks for the links. Does any of these editors support the imported Rhino stuff? Can you see the available methods, arguments etc.? What about debugging?

Xcode also works as a python editor, but I wonder if there is a way to bind it with the Rhino SDK? Maybe @stevebaer or @marlin can say something before I dig into the impossible…


#5

Hi Jess,

Here is a screenShot of Atom with a simple python script I just wrote to help with some view captures I have to do with each product.

I know for now there is no built in OSX Python Editor like on Windows Rhino. Probably will come as Python is mostly same on OSX & Win.

It is also linked to default Scripts folder so Rhino recognizes the scripts. Not sure what your debugging workflow needs are though. Probably up to you.

Cheers


(Steve Baer) #6

Unfortunately, you are digging a little into the ‘impossible’. @Alain has done some work to try and get remote debugging to work (debug from a separate application), but we don’t yet have a good solution on OSX. We do plan on writing an editor or figuring out how to work better with existing editors, but again this is a project that requires quite a bit of research and I’m not too sure where we are with respect to that research. I’m letting @Alain take the lead on that project :slight_smile:


#7

OK, Steve - thanks for the info.
For now I’ll try atom like Randy recommended.
Thanks again,
Jess


(Alain Cormier) #8

Hi all,

I did some experiments with remote debugging with Rhino on Windows using PyCharm and PyDev:
PyCharm screencast
PyDev screencast
but some work is needed to get things working on the Mac.

Much of the editor work we’re doing now is about upgrading the editor on Rhino for Windows but we’re trying to make it as cross platform as possible so it’ll be easier to have a solution on the mac.


#9

Hi Alain,

thanks for the info. If you can port Rhino’s python editor from windows to mac this would be sufficient for my needs. Let me know when there is something to test…


#10

Has anyone tried to configure Sublime Text to achieve autocompletion like @stevebaer with Komodo?


(Alain Cormier) #11

No but it’s on my list. The first thing I’d look at is SublimeJEDI


#12

I got Sublime Text 3 with SublimeJEDI autocomplete. Just install SublimeJEDI and add this to your settings file:

“python_package_paths”:
[
"/Users/YOUR_USER_NAME/Library/Application Support/McNeel/Rhinoceros/MacPlugIns/IronPython/settings/lib"
]

That’s all I had to do!


#13

Hello all,

so I think that I have a config that works very well with Sublime Text 3.

  1. Using Package Control, install Anaconda
  2. Edit the User/Anaconda.sublime-settings as such:
{
    "anaconda_linting": false,
    "display_signatures": true,
    "extra_paths":
    [
        "/Users/USER-NAME/Library/Application Support/McNeel/Rhinoceros/MacPlugIns/IronPython/settings/lib"
    ]

}

This will not only allow for Auto-Completion but also DocString look-up (using control+Alt+D).

Any other questions as for config should be consulted on the site.


#14

tbh, i don’t even know what remote debugging is supposed to offer :poop:

i just got sick of the process of getting the script to run in rhino to see if it works (and doing that process a hundred times an hour)… but so far, rhino seems to tell me where the errors are happening and in many cases, why it’s happening… so that’s sweet.

here’s a pretty ch_easy little workaround to the switching problem:

( http://youtu.be/CGWUnuiVix0 )

managing the files will need a decent game plan but i think if you have 2-3 files just for the switching/writing/copy&pasting/etc then using Duplicate(or other methods), put them in ‘real’ files when need be, it should work out ok…


Atom crashes / hangs 'frequently'
#15

Well, as you seem to be starting to script in earnest, you will soon really want to have a script editor with an integrated debugger function … The debugger allows you to stop the script at any chosen point (“breakpoints”) and look at the value of all your variables - which will help you figure out your errors very quickly in most cases. As in “Aha, my variable xxx is a string when it should be a list…” or “Hmm, this function is returning None, so it’s failing somehow, maybe I better see what’s happening there…”

At the Rhino reseller meeting in Barcelona they seemed to have found something that might work on the Mac side - an editor/ debugger is not something you write yourself, you adapt something that exists - but I don’t know how/when that might happen or if it will before release time - I hope so. That’s why I still develop in Windows and just run the script on Mac afterwards via a Dropbox folder as a final test.

Cheers, --Mitch


#16

yeah, i watched some videos and saw the built-in editor… i want that :smile:
the thing in the video is just a stop-gap solution until macRhino gains an editor (or capabilities to communicate with outside solutions)

re: earnest…
i basically want to do 5 scripts… which would probably have a fair value of $500 each to outsource / customize to my liking… so i’ll view it as me paying 2500 for tuition (in the form of time etc) and learning how to write them myself :wink:
what happens after that, i don’t know but i’m pretty sure i’ll come up some other ideas for scripts after the initial ones are written.


#17

oh… something else i found out with Xcode that’s pretty sweet…

you don’t even have to do what i showed in the video in order to get easier testing abilities… with xcode/python/rhino, you can have an open & unsaved document and the unsaved contents will be read when you run the script in rhino…
for example-> this works:


• make a blank python file (example.py) and place it in your rhino scripts folder
• open example.py in xCode
• type print "hello rhino" (do not save*)
• in rhino, use RunPythonScript then choose example.py
• “hello rhino” will be returned in rhino

*you can save if you want… just sayin, you don’t have to.
then you can go back to xcode, type some more stuff, not save, run the script in rhino again and the updates are read… it’s reading the unsaved file.

if you put a keyboard shortcut (like ⌘R) to ! -_RunPythonScript example, it becomes even easier to test the script.
or, the setup i’m using is with the service as outlined in the video in xcode… when set up this way, you can run the script from either rhino OR xcode… ⌘R in either application will trigger the script to run in the exact state it’s in… so, you don’t have to worry about which app has focus at the time of activating the script… honestly, it almost feels like you’re only in rhino when set up this way.

i tried it in quite a few editors and none worked this way except xcode… the only one which comes close is Chocolat which has the following preference setting:

so with that, you can type in the .py… then go to rhino-> activate the script and it will work since when you switched to rhino, the file saved automatically.



EDIT-- oh, i get it that if you’re on windows, this stuff probably seems a bit backwards and/or worse… but, if you’re on mac, it’s actually moving forward because at first glance, writing scripts on mac is pretty bad :wink: …these little tricks make it easier for now.


#18

re:debugger

hmm… i think i messed up and watched the video here.
(starting at ~6 minutes)

i think that functionality would be VerY helpful at times…
makes me feel like i’m flying blind now :wink:


#19

Hi Jeff,

While a debugger surely is a great thing, I find myself rarely needing one when writing Python code (I mainly write directly in the Grasshopper Python editor, which is also very bare bones). I instead use the help() and dir() functions extensively for introspection of functions and objects.

Since you are using the RhinoScriptSyntax module this may not help as much as if you were implementing RhinoCommon directly (i.e. you are probably usually operating on GUIDs and not directly on geometry types).

That said, I would still recommend learning to use these functions. Especially since they are vanilla Python functions which can be called in any Python environment, never having to fly blind again :wink:

/Anders


#20

hey anders, thanks for the info

yes, as of now, i’m using GUIDs… and to be honest, i don’t know what you mean by “not directly on geometry types”.
regardless, i’ll check out the links and try the examples to see how it can help me.


on a side note, i found something simple that helps me immensely when manipulating planes… that being- temporarily add a plane surface via rs.AddPlaneSurface… at least then i can see what’s going on :wink:
(posting in case a python newb reads this later… it will probably help them out too)