Problem with Tutorial About Making a Python .pyx File - python

I've looked for every possible way to create a .pyx file from saving a .py file. I followed this YouTube tutorial. However, when I used VSCode, it returned a blank .pyx file.

Thanks To davidw it's fixed Just by changing the File name and using the Correct Editor

Related

Compile pycharm project into a single .py file?

I have recently finished my first project in pycharm in which I have multiple pycharm files and am importing between them. I am trying to now compile it all into one big .py file as that is what my course has requested me to do. Is there an easy way to do this without having to copy paste between them all?
Every search I have found for compiling in pycharm shows how to compile it to a .exe, whereas I want it in one big .pyfile.

Main Python File Using Another Python File (I Want To Convert To .exe)

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

Problems with visual studio code

The file got corrupted its missing some code from everywhere.
Are you sure you saved the edits to the file?
VSC has a buffer for changes, so you can pick up where you left off on a file without actually saving your modifications to it. If you open the file by folder, you might skip over that cache and see what looks like an outdated version.

Pandas File Not Found Error -- Worked Yesterday

Yesterday I imported an sas file into Pandas, and was able to successfully poke around the data. This morning, I received a file not found error, although I did not move any files.
I triple-checked the path and it was correct. Then I tried placing a copy of the file on my desktop and redirecting read command. Same error. (This is the type of thing that makes you feel crazy.) Any help appreciated.
Unless that you have a folder named Dropbox inside your project directory, I suggest you use the full path of your file:
/home/<username>/Dropbox/Thesis Fall 2017/Data Analysis/epcg17.xpt
OR
~/Dropbox/Thesis Fall 2017/Data Analysis/epcg17.xpt
Both should work.

How to convert multiple python files to EXE?

I am trying to convert my python application to an exe. I have seen things like py2exe and cx freeze, but they only compile one single py file. Can anyone help me? Thank you
I currently use pyinstaller for building projects into single-executable files. These projects all contain multiple python (and some non-python) files that are all "built into" the exes.
That being said, even with multiple python files included, Marcus Müller is correct. There is one entry point for a given executable.
In summary, if you have multiple files as part of a single project, pyinstaller along with the other python bundlers will handle this scenario.
If you have multiple files and want them each to be their own executable file, you will need to treat each as its own 'project' and package each individually.
What platform(s) are you targeting? Can you describe the intended purpose of the files? Can you describe the intended usage of the files?
Posting an example of what you currently have, what behavior you are observing, and clarification on what is different between what you are expecting and what you are observing would definitely help others in guiding you towards the answer you desire.
Edit:
Well, I have a main python file that is referenced to a very brief config.py. The main file also accesses a few text files. Could I just combine the config and the main into one py file, and make that an executable, and will that executable still have access to the text files?
Your main python file would be your exe's entry point. If you import your config file into your main, pyinstaller should see the import and include it. On this line, verify your PATH environment variable, and insure your system knows where to find the bits it needs. If the text files are to be included as part of the built executable file, pyinstaller has the ability to include files into the build as well (example, include a database, a config, or a static data set). An example question describing including an icon file for a build: include-pyinstaller-icon
For example in PyInstaller, you can specify additional folders which should be involved in your executable file.

Categories

Resources