Newbie type questions

User 3324 | 3/19/2016, 10:46:08 PM

Hi guys- a few easy questions probably. thanks in advance for the help.

  1. I downloaded the Dato Launcher and can use this to work, ie it starts in my main Window directory, launches a notebook in the browser and i can "import graphlab" to get started. However, if i launch the notebook from a subdirectory, i can't "import graphlab"- it appears to only work when i use the launcher. is that because i need to enable the environment somehow, ie "activate dato.env"?

  2. If i form a python function in a .py file (and one that uses the graphlab library) I can type "import graphlab" at the top. However, one function didn't work until I also entered "from graphlab import SFrame". Why do I need both? Also, in reference to question #1, If i have .py files in subdirectories but i can't "import graphlab" from that branch level, how can i fix this?

  3. Lastly, is there any reason why i can't have multiple python functions inside a .py file? For instance, i have 2 functions in which one calls the other and the first one uses graphlab. Again, my approach is to type "import graphlab." at the top but that doesn't seem to work. I know that this is a vague question but I thought that I would just ask in case there is some type of dependency.

thank you much!

Comments

User 1178 | 3/29/2016, 6:31:12 PM

Hi Mark,

To answer your questions:

  1. Yes, Dato Launcher helps you setup appropriate Python environment. If you do it outside, you will need a lot of effort to get the environment right. Python is tricky to setup sometimes.
  2. I guess you are referencing SFrame directly in your .py file and you need to explicitly import it in order for Python to be able to resolve the name correctly. If you do not want to import directly, you may reference SFrame through graphlab.SFrame.
  3. You can definitely have multiple functions inside a .py file. I am not clear what issues you have encountered, so if you can give us more information, we can help you.

Thanks!

Ping