Skip to content
Snippets Groups Projects
Closed Publish fails to execute when called from python command line
  • View options
  • Publish fails to execute when called from python command line

  • View options
  • Closed Issue created by Hock, Martin

    When calling the publish function from command line or from python console instead of from a script, the function that tries to copy the calling script crashes.

    >>> publish(['README.md'],'./export',A,'Smiley')
    C:\git\NFDI4ing\plot_ID_python\plotid\publish.py:132: UserWarning: Folder "export" already exists – plot has already been published.
      warnings.warn(f'Folder "{self.dst_dirname}" already exists – '
    Do you want to overwrite the existing folder? (yes/no[default])
    yes
    Copying data has been started. Depending on the size of your data this may take a while...
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "C:\git\NFDI4ing\plot_ID_python\plotid\publish.py", line 247, in publish
        publish_container.export()
      File "C:\git\NFDI4ing\plot_ID_python\plotid\publish.py", line 157, in export
        self.individual_data_storage(dst_path_invisible, plot_paths)
      File "C:\git\NFDI4ing\plot_ID_python\plotid\publish.py", line 209, in individual_data_storage
        shutil.copy2(sys.argv[0], destination)
      File "C:\Python310\lib\shutil.py", line 434, in copy2
        copyfile(src, dst, follow_symlinks=follow_symlinks)
      File "C:\Python310\lib\shutil.py", line 254, in copyfile
        with open(src, 'rb') as fsrc:
    FileNotFoundError: [Errno 2] No such file or directory: ''

    Could this be caught by implementing a check whether the call was made from a script?

    Linked items 0

  • Link items together to show that they're related or that one is blocking others.

    Activity

    • All activity
    • Comments only
    • History only
    • Newest first
    • Oldest first