Problems with visual studio code - python

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.

Related

File Permission InstallForge

I have written a Python program, this must change the contents of a file for a function.
This also works so far, but I have now converted this with Auto-py-to-exe into a folder, and also the required file is inserted.
When I open this exe file, everything works!
The problem occurs when I use InstallForge to convert the file to an installer file, transfer the file to another PC, restart the PC, open the software, and then try to use the function that describes a file. The software then crashes and the file is not saved.
If I run the software as admin, it doesn't get the error, so that means yes, to be able to rewrite files in the folder, you need admin permission. But it's just inconvenient to always be able to open the app by right clicking and then using "run as administrator".
Is there any way to simplify this? Can i use InstallForge to set special permissions to the files?
I have try, to search about it in the internet, but i havn't found anything about that.

How to prevent spyder from creating temp files in the same directory of the file I save

I installed spyder with pip (not with anaconda).
Whenever I save a .py file, spyder also generates a temp file containing a copy of the file source, in the same directory. Something like this
where each file starting with "tmp" contains the source of a different version of main.py. In the past, when I installed spyder with Anaconda, this never occurred.
Is there a way to deactivate this feature? Or at least to force spyder to save these temp files somewhere else?
Not sure if you are still troubled by this issue. Are you using Dropbox or some similar services?
I've met the same problem as you did, and I found the reason on Github, see #13041.
If you can try to work outside Dropbox, you don't see any tmp files. This works for me and hope it can help you.

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.

Should I include the .pyc byte code when saving a project to a read-only storage?

Yes, I read some of those .pyc questions, but still nothing.
I need to save a project to a CD and preferably I'd like to be able to run it right from there. Should I put the .pyc files in there or not?
No,
byte-code is not version compatible
Yes
the project is supposed to run with the same python version
.py files won't be changed any more in that release
it might be load faster
if smth doesn't suit, python will (need to) create new .pycs somewhere anyway
The latter one: Python will handle that and use a temp directory, won't it?
Answer : No Need to Include
You want to Compile & Run Means :-
Your question says, you are going to compile your python source code in another machine. When you compile your code, the ".pyc" file will be created. So, it is not necessary to include the ".pyc" file with your cd. If you put means, no problem, when you compile your source code in another machine, it will replace the ".pyc" file with the newly created ".pyc" file.
You want to Only Run Means:-
But, if you want to run without compile means, you should convert your program into executable. Executable file may be for windows or linux.
For Linux, to create executable file : Use "CDE" package.
Link: http://www.pgbovine.net/cde.html
For Windows, to create executable file : Use "Py2Exe" package
Link : http://www.py2exe.org/index.cgi/WorkingWithVariousPackagesAndModules
I hope this is the answer you want.
PYC is python bytecode making the original code run faster. You can omit it, since your code will still be able to run.
However if you need to run your code on different machines, probably without any python distribution. Take a look at
http://www.py2exe.org/ which is for windows only
http://www.pyinstaller.org/ which is for most systems
I personally worked with py2exe, it is simple to use. Although it makes fairly huge package, since it add all python packages required to run the original python script.
Hope this is helpful for You.

Python files created do not save as python file

https://drive.google.com/file/d/0BwR0ium7uufRWnhXWWNFcVJ3S2c/edit?usp=sharing
The files that are blank and say "Credit Card Balance" and "mine" are the files which I created by opening up a new document in IDLE and creating a file. The ones with the little pictures and say ps2_newton are programs which I downloaded off of the internet. I can't open my files which I created like they are regular programs and have to open them under notepad to see the code. Why is this? How can I change my files to look and act like the ones I downloaded?
The files you downloaded have an extension of ".py", which tells Windows to open them with the Python launcher, while the ones you created have no extension, or an extension of ".txt", which tells Windows to open them in Notepad.
Since ".py" and ".txt" are both "known extensions", and you have Explorer configured to hide known extensions (which I believe is the default in all versions of Windows), it doesn't show them to you. However, you can see the difference in the icons.
You can configure Explorer to show all extensions, but this site is not the place to ask about that—try SuperUser.
Meanwhile, when you save your scripts, make sure you save them with a .py extension (or, if they're Tkinter or other GUI apps, with a .pyw extension).
I had the same problem. But I just deleted all of the é's and á's etc. And it worked! So try that IF it is an .py file. Otherwise I understand if it does not work becouse it isn't a python file. You change that by doing this: Save as. Just simply type .py after the file name.
PS Sorry for my bad english...

Categories

Resources