Skip to content

Subprocess doesn't execute #2

@jay-pee

Description

@jay-pee

I have problems to run this plugin. I saw that ankdown is not producing any output package so I tried to debug this by looking at the subprocess.run() returns in more detail. This can be done by using sys.stderr.write() so it is displayed in anki.

    tmp = subprocess.run([ANKDOWN, "-r", d, "-p", package_name])
    sys.stderr.write(str(tmp.stderr) + '\n')
    sys.stderr.write(str(tmp.args) + '\n')
    sys.stderr.write(str(tmp.returncode) + '\n')
    # AnkiPackageImporter(mw.col, package_name).run()

The output of this is:

    None
    ['/usr/local/lib/python3.6/site-packages/ankdown/ankdown.py', '-r', '/Users/philipjanssen/Documents/Flashcards', '-p', '/Users/philipjanssen/Downloads/Flashcards.apkg']
    1

So the return code is 1, which mean some error occurs. If I run this code in the terminal with the exact same arguments I don't get an error and an output is produced. I don't know how to go on with debugging. Can you help me?

P.S.:

I tried to do the subprocess manually and only use the import part like so:

         # tmp = subprocess.run([ANKDOWN, "-r", d, "-p", package_name])
         AnkiPackageImporter(mw.col, package_name).run()

but even this dosn't work for me. I don't get any error but the deck is not imported :-/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions