• rhithyn

    I think I've found a bug with editor.make_new_file. If an absolute path is given, it will just crash with an "undeclared variable before use" error.

    Stack dump:

    Traceback (most recent call last):
    File "_ctypes/callbacks.c", line 234, in 'calling callback function'
    File "/var/containers/Bundle/Application/97D3CA1E-BD16-4F1A-B952-153773020E29/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/objc_util.py", line 1064, in OMMainThreadDispatcher_invoke_imp
    retval = func(*args, **kwargs)
    File "/var/containers/Bundle/Application/97D3CA1E-BD16-4F1A-B952-153773020E29/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/editor.py", line 124, in make_new_file
    full_path = os.path.join(doc_path, new_name)
    UnboundLocalError: local variable 'doc_path' referenced before assignment

    If I get the path of the current editor file, and pass it into make_new_file (which should make a number-incremented file in the same folder), it fails.

    I have an idea for a workaround (parsing the path down to the "Documents" folder and using that path) but wanted to give a heads up about this bug.

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!