I want to create the notebook directory when my user logs in for the first 
time.  Looking through the issues, I found a couple of suggestions and am 
trying this:

from jupyterhub.spawner import LocalProcessSpawner
import os

class MySpawner(LocalProcessSpawner):
    def _notebook_dir_validate(self, value, trait):
        # Strip any trailing slashes
        # *except* if it's root
        _, path = os.path.splitdrive(value)
        if path == os.sep:
            return value

        value = value.rstrip(os.sep)

        if not os.path.isabs(value):
            # If we receive a non-absolute path, make it absolute.
            value = os.path.abspath(value)
        if not os.path.isdir(value):
            os.mkdir(value, mode=0o755)
        return value

c.JupyterHub.spawner_class = MySpawner

But I'm getting this when I start jupyterhub:

Traceback (most recent call last):                                     
  File "/usr/local/lib/python3.5/dist-packages/jupyterhub/app.py", line
    yield self.initialize(argv)                                        
  File "/usr/lib/python3.5/types.py", line 179, in throw               
    return self.__wrapped.throw(tp, *rest)                             
  File "/usr/local/lib/python3.5/dist-packages/jupyterhub/app.py", line
    yield self.init_spawners()                                         
  File "/usr/local/lib/python3.5/dist-packages/jupyterhub/app.py", line
    self.users[orm_user.id] = user = User(orm_user, self.tornado_settin
  File "/usr/local/lib/python3.5/dist-packages/jupyterhub/user.py", lin
    config=self.settings.get('config'),                                
  File "/usr/local/lib/python3.5/dist-packages/traitlets/traitlets.py",
    inst.setup_instance(*args, **kwargs)                               
  File "/usr/local/lib/python3.5/dist-packages/traitlets/traitlets.py",
    super(HasTraits, self).setup_instance(*args, **kwargs)             
  File "/usr/local/lib/python3.5/dist-packages/traitlets/traitlets.py",
    value.instance_init(self)                                          
  File "/usr/local/lib/python3.5/dist-packages/traitlets/traitlets.py",
    inst._register_validator(self, self.trait_names)                   
  File "/usr/local/lib/python3.5/dist-packages/traitlets/traitlets.py",
    _deprecated_method(class_value, self.__class, magic_name,          
AttributeError: 'MySpawner' object has no attribute '_HasTraits__class'

What am I doing wrong?  Thanks for any help!

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/3755a0c5-0dbd-46ee-a715-8f093f5dec98%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to