R
R
Ridalit2020-09-01 21:17:18
Python
Ridalit, 2020-09-01 21:17:18

How to copy files in python without using shutil and os modules?

Hello. I'm using pyinstaller to create a python .exe, and faced this problem: after "compiling" into .exe, the os module stops working properly (for copying I use os.system(copy"" "")) : on startup commands from exe - an empty console opens for a second, after which it instantly disappears and nothing happens ... And when importing shutil - the sketch does not start at all and immediately gives an error.
(Before "compiling" everything works fine)

Maybe there is a way to fix this, or more modules for working with files? Or perhaps there is some other way to copy files using os?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor T2, 2020-09-01
@Ridalit

CREATE_NO_WINDOW = 0x08000000 # don't pop up a console window
subp = subprocess.Popen('copy source.txt destination.txt', stdout = subprocess.PIPE, creationflags=CREATE_NO_WINDOW)
subp.wait()
something like this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question