Hi all,

I'm trying to export all courses, so I can have an automated backup of the 
courses my colleagues are making. I've tried running this on ficus.1 on a 
manually deployed live stack as well as on ficus.2 on the docker devstack:

    "source /edx/app/edxapp/edxapp_env && \                                 
     
     python /edx/app/edxapp/edx-platform/manage.py \                       
      
     cms --settings=devstack_docker export_all_courses 
/edx/app/courses/export/" 


But this leads to 

manage.py export_all_courses: error: unrecognized arguments: /edx/app/
courses/export/

I tried fixing this problem like so:

class Command(BaseCommand):                                                 
       
    """                                                                     
    
    Export all courses from mongo to the specified data directory and list 
the courses which failed to export
    """                                                                     
       
    help = 'Export all courses from mongo to the specified data directory 
and list the courses which failed to export'
                                                                            
       
    def add_arguments(self, parser):                                       
        
        parser.add_argument(                                               
        
            'output_path',                                                 
        
            type=str,                                                       
       
            help="output path for the course export")                       
       
                                                                            
       
    def handle(self, *args, **options):                                     
       
        """                                                                 
       
        Execute the command                                                 
       
        """                                                                 
       
        # if len(args) != 1:                                               
        
        #     raise CommandError("export requires maarten one argument: 
<output path>")
                                                                            
       
        output_path = options['output_path']                               
        
        courses, failed_export_courses = export_courses_to_output_path(
output_path)
                                                                            
       
        print "=" * 80                                                     
        
        print u"=" * 30 + u"> Export summary"                               
       
        print u"Total number of courses to export: {0}".format(len(courses)) 
      
        print u"Total number of courses which failed to export: {0}".format(
len(failed_export_courses))
        print u"List of export failed courses ids:"                         
       
        print u"\n".join(failed_export_courses)                             
       
        print "=" * 80   

But now I have a new error!

Traceback (most recent call last):
  File "/edx/app/edxapp/edx-platform/manage.py", line 116, in <module>
    execute_from_command_line([sys.argv[0]] + django_args)
  File 
"/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/__init__.py"
, line 354, in execute_from_command_line
    utility.execute()
  File 
"/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/__init__.py"
, line 346, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File 
"/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/base.py"
, line 394, in run_from_argv
    self.execute(*args, **cmd_options)
  File 
"/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/base.py"
, line 445, in execute
    output = self.handle(*args, **options)
  File 
"/edx/app/edxapp/edx-platform/cms/djangoapps/contentstore/management/commands/export_all_courses.py"
, line 30, in handle
    courses, failed_export_courses = export_courses_to_output_path(
output_path)
  File 
"/edx/app/edxapp/edx-platform/cms/djangoapps/contentstore/management/commands/export_all_courses.py"
, line 48, in export_courses_to_output_path
    courses = module_store.get_courses()
  File 
"/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/modulestore/mixed.py"
, line 90, in inner
    retval = func(field_decorator=strip_key_collection, *args, **kwargs)
  File 
"/edx/app/edxapp/edx-platform/common/lib/xmodule/xmodule/modulestore/mixed.py"
, line 322, in get_courses
    course_id = self._clean_locator_for_mapping(course.id)
AttributeError: 'HiddenDescriptorWithMixins' object has no attribute 'id'




Any ideas? Did this work at some point and is it broken, or is it just me?

-- 
You received this message because you are subscribed to the Google Groups 
"General Open edX discussion" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/edx-code/1ad4fd10-eaf0-4d2a-9256-a0e1bd740b93%40googlegroups.com.

Reply via email to