EDIT
This is my code:
import pyperclip
text_file = open("dewey.txt", "rt") #Open the list containing the values
text = text_file.read().split('\n')
text_file.close()
num = []
with open ('dewey num.txt', 'rt') as in_file: #Open the list containing the keys
for line in in_file:
num.append(line[:3])
intenum = []
for i in num:
intenum.append(int(i)) #Make the keys as integers
dict1= dict(zip(intenum,text)) #Merge the 2 lists in a dictionary
print ('This software will give you the subjects for each stack.') #Instructions for the user
print ('I need to know the range first, please only use the first three numbers of the classmark.') #Instructions for the user
x=input('Please key in the starting number for this stack: ') #Input for start
y=input('Please key in the last number for this stack: ') #Input for stop
start = int(x)
stop = int(y)
values = [dict1[k] for k in range(start, stop + 1) if k in dict1] #Call the values in range
print('The subject(s) for this section: ')
for i in values: #Print the values in range
print (i)
output = '\n'.join (values)
pyperclip.copy(output)
It's working as it should within python, so I compiled it to .exe using Pyinstaller.
I managed to have an exe file now but I'm struggling with the import of pyperclip.
the exe works except for that last command. I tried -p dir and also --hidden-import pyperclip.
I ran it with -d and the debug I get is:
PyInstaller Bootloader 3.x
LOADER: executable is C:\Users\aless\AppData\Local\Programs\Python\Python35\dist\deweycheck\deweycheck.exe
LOADER: homepath is C:\Users\aless\AppData\Local\Programs\Python\Python35\dist\deweycheck
LOADER: _MEIPASS2 is NULL
LOADER: archivename is C:\Users\aless\AppData\Local\Programs\Python\Python35\dist\deweycheck\deweycheck.exe
LOADER: No need to extract files to run; setting extractionpath to homepath
LOADER: SetDllDirectory(C:\Users\aless\AppData\Local\Programs\Python\Python35\dist\deweycheck)
LOADER: Already in the child - running user's code.
LOADER: Python library: C:\Users\aless\AppData\Local\Programs\Python\Python35\dist\deweycheck\python35.dll
LOADER: Loaded functions from Python library.
LOADER: Manipulating environment (sys.path, sys.prefix)
LOADER: Pre-init sys.path is C:\Users\aless\AppData\Local\Programs\Python\Python35\dist\deweycheck\base_library.zip;C:\Users\aless\AppData\Local\Programs\Python\Python35\dist\deweycheck
LOADER: sys.prefix is C:\Users\aless\AppData\Local\Programs\Python\Python35\dist\deweycheck
LOADER: Setting runtime options
LOADER: Initializing python
LOADER: Overriding Python's sys.path
LOADER: Post-init sys.path is C:\Users\aless\AppData\Local\Programs\Python\Python35\dist\deweycheck\base_library.zip;C:\Users\aless\AppData\Local\Programs\Python\Python35\dist\deweycheck
LOADER: Setting sys.argv
LOADER: setting sys._MEIPASS
LOADER: importing modules from CArchive
LOADER: extracted struct
LOADER: callfunction returned...
LOADER: extracted pyimod01_os_path
LOADER: callfunction returned...
LOADER: extracted pyimod02_archive
LOADER: callfunction returned...
LOADER: extracted pyimod03_importers
LOADER: callfunction returned...
LOADER: Installing PYZ archive with Python modules.
LOADER: PYZ archive: out00-PYZ.pyz
LOADER: Running pyiboot01_bootstrap.py
LOADER: Running dewey.py
I'm not sure how to proceed right now :\ any input?
In the end I managed to import all the dependencies by using the command 'pyi-makespec' which then required an additional step to make the actual exe file. The documentation for pyinstaller is really extensive and accurate. Thanks @Repiklis for your inputs