Hi guys, I wrote a script in Python 3 and it works. When I start my script ".py" a cmd terminal appears and from there I'm able to drag and drop a file into it to get the full path about the file. Now I converted my script in an ".exe" file with Pyinstaller. The script works exactly as before, but when I try to drag and drop a file into the cmd terminal, the full path is not inserted, the drag and drop action doesn't produce any kind of effect in the terminal. How can I solve this issue?
Pyinstaller - I can't drag and drop into the CMD terminal anymore..
Pyinstaller - I can't drag and drop into the CMD terminal anymore..
|
Jan-11-2020, 03:52 PM
(This post was last modified: Jan-11-2020, 03:52 PM by Clunk_Head.)
Your script extracts file paths from shortcuts?
In what OS? Assuming Windows because cmd and exe How does it do this? Why use the terminal? Can't you create a special window for this that will work regardless of how the program is stored? Why does it need to be an exe?
Jan-11-2020, 05:07 PM
(Jan-11-2020, 03:52 PM)Clunk_Head Wrote: Your script extracts file paths from shortcuts?my script ask the user a path (example: "C:\Users\Pippo\Desktop\file.txt") because it needs to know where is a specific text file. then it will read it and produce a new file. to give the specific path to my script, you have two choises, the first one is write by hand it in the cmd terminal, the second one instead is drag and drop the file in the cmd terminal. the second one is easier and simpler then the first one, but it works only if I run, let me say, the ".py" version of my script. the drag and drop doesn't work if I use the ".exe" version of my script. (Jan-11-2020, 03:52 PM)Clunk_Head Wrote: In what OS? Assuming Windows because cmd and exeWindows 10 Professional, x64 (Jan-11-2020, 03:52 PM)Clunk_Head Wrote: Why use the terminal? Can't you create a special window for this that will work regardless of how the program is stored?my script don't have a GUI, it's just a CLI script. when you open it you will see the cmd terminal. (Jan-11-2020, 03:52 PM)Clunk_Head Wrote: Why does it need to be an exe?because I have to use it on different PC without python installed.
Jan-11-2020, 10:08 PM
I can do a test.
# drop.py import sys drop_file = sys.argv[1] print(f'You dropped {drop_file}') with open(drop_file) as f: print(f.read()) input('Press <Enter> to exit')Make a drop.bat file to drop to as it has all permission for drag drop,.py can be blocked in Registry."C:\python37\python.exe" drop.py %*Build with Pyinstaller. pyinstaller --onefile --add-data drop.bat;. drop.pyNow can drop files to drop.exe ,eg it will work for txt,csv,html... ect.
Jan-25-2020, 12:24 PM
sorry for the delay guys, I solved my issue only in these days. I don't know why, but the drag and drop issue appears only if the program is named as "setup.exe". to solve the issue, you have to change just the name. simple :)
|
|
Possibly Related Threads… | |||||
Thread | Author | Replies | Views | Last Post | |
My first script does not work anymore | redfirebrooks | 2 | 3,034 |
Jan-05-2021, 10:49 AM Last Post: redfirebrooks |
|
Code used to work, not anymore for no apparent reason? | chicagoxjl | 1 | 2,468 |
Jan-08-2020, 05:05 PM Last Post: jefsummers |
|
Python code suddenly not working anymore | mike_b | 5 | 7,822 |
Oct-02-2019, 03:38 PM Last Post: ichabod801 |
|
All of a sudden Pycharm doesn't run anymore (select valid interpreter) | Luke_Drillbrain | 1 | 6,114 |
May-04-2017, 07:30 PM Last Post: buran |
|
Windows: Put File automatically under Cursor for Drag & Drop | sym | 1 | 4,286 |
Jan-13-2017, 04:55 PM Last Post: Larz60+ |
Users browsing this thread: 1 Guest(s)