I want to make a programming language with a specific end of the files (.example) which can be in every folder and executed by the python file (example/example.py) with the argument where the .example file is, that the python file can open it.
I've already tried it to setup in the normal Windows Settings and on the .example itselfs (open with), but there is no chance for making it work.
Solution
arbitrary custom file extensions can be run with Windows python using the file association feature of windows
Step by step (Windows 7)
create you new file extension
open the file as usual
you will see unable to find software to open this file
choose ... search through windows
choose ... Select a program from a list of installed programs
choose ... Always use the selected program to open this kind of file
navigate to the directory containing pythonw.exe
Screenshot
Related
I have a Python application built under PyInstaller on a MAC. I do not want to have a terminal window when it is running so I specified the --noconsole option. Apparently, under MACos, this option still provides a console (terminal) window if you use the EXE file. If you use the MAC application package to start, then you do not have the console/terminal window.
The problem is that the program reads a data file at initialization. When I run the EXE, that data file is in the same directory as the EXE and it loads fine. But when it runs as an app, it reads from the default working directory and I have no idea where that is. So it can't find the data file required. And reading further it seems from MAC OS to OS the working directory location might change. I moved the data file where the EXE is in the MAC application, but when Python reads that is not the directory it is reading from.
So how can I place the required data file somewhere the Python application (not running the EXE directly) will find it.
Under Windows, the data file is just in the same directory where the EXE is running and there is no console window. There is no concept of the MAC application type. But if I don't want to have the Terminal window, I need to resolve where to place a data file so that will be found.
I suggest digesting some of these basic Apple macOS developer documents. All your answers will come through understanding these.
Bundles
Codesigning
Information Property List
Entitlements
Embedding Non-standard Code Structures
I would like to create an executable file from my python project that consists of one python file that uses gecodriver.exe, I have tried using pyinstaller for this matter, however the program closes as soon as it opens, basically it doesn't work. I suspect that the .exe file that is created by pyinstaller does not include or cannot see geckodriver. Any sugestions how to make it work will be helpful.
I Created a Program That Has 2 .py files.
I Want To Make The Program a .exe file, I do it using cx_Freeze.
My Problem Is That I Convert The main.py To .exe but The Second Python File Is Still a .py File.
I Don't Want It Be a .py Because If It Is The User Can See The Code.
If I Also Convert The Second Python File The Program Doesn't Work Because I import The Python File In The Main File.
Any Suggestions?
(I Don't Want To Copy The Second Python File To The Main Python File)
You are chasing the wrong rabbit here. The various tools that generate executable files from Python code are not compilers. They are just tools that embed a Python interpretor with py (or pyc) files to allow users to use the program without a prior Python installation.
Said differently you should not use them to hide your code (except from people not knowing a lot of Python): a pyc does not contain text code but according to the answers to Is it possible to decompile a compiled .pyc file into a .py file? , tools exists that convert back a pyc file into a py file (of course except the comments).
IMHO, you should better google for python obfuscate to find tools dedicated to obfuscation, what neither cx-freeze nor pyinstaller are.
BTW while there are appropriate use cases for obfuscation you should be aware that a determinate attacker can always circumvent it. The reason why the real protection for intellectual property is law and not technics...
I'm not sure how two or more .py files can be converted to .exe.
But in python the easiest way to convert to .exe is a module named pyinstaller .
You can install it using command pip install pyinstaller can get it . After just go to the directory where your project files are and open command prompt in that directory and execute pyinstaller file_name
So I had python for a long time, but I didn't code just downloaded scritps and all that. I wanted to install python 3.7, when I did everything seemed to work fine, but my .py files didn't open.enter image description here
Images
You may tell windows what program should open py files with. If you want to open them with a text editor or a python interpreter installed, etc. Go to start menu and type "default programs", from there you need to tell windows what praogram you want to associate with py file
Is it possible in Eclipse (pydev) to include folder (names) in the Open Ressource file navigation?
When opening specific files in one of my projects I often use the Open Ressource (see the Eclipse help) dialog (Navigate -> Open Ressource). This way I don't have to remember (or keep track in a multi-developer project), where a specific file is placed, but only the file name.
This only seems to filter through file names. I would rather like to
(optionally) include the folder name
open python package file __init__.py in the editor
(or any other configurable custom file like __custom_module__.py)
How can I achieve this?
For finding any file, Ctrl+Shift+R (open resource) is good, but to find a Python package/module/class/method, Ctrl+Shift+T (Python tokens browser) is better -- you can filter by the module name as you want -- see the docs on the dialog when you open the tokens browser.
Note: you need to focus some PyDev editor for it to become active (such as the PyDev package explorer or a PyDev editor).
Note 2: You may still use a filter with folders in the open resource if you filter with the path (i.e.: *package/file*.py)