Well this is another issue faced by noobs. According to a recent report (Stack Overflow: Helping One Million Developers Exit Vim) exiting VIM is one of the most searched article on Stack Overflow. This article is intended to help noobs exit in a Linux environment.
Exiting the CLI
To force quit or “kill” a running command, you can use “Ctrl + C”. most of the applications running from the terminal will be forced to quit.
Exiting Nano Editor
If you are using the nano editor, simply press “Ctrl + X” to exit. This will prompt you whether you want to save before quitting or not.
Exiting VIM
Press “Esc” to initiate exit sequence
Then type a colon “:” Remember after pressing Esc and “;“, you may not see this action taking place, but simply continue with the next step
Continue typing “q!” to force quit without saving. If you want to save the changes instead of “q!“, type “wq” (This means write then quit).
Well there was no need for creating a blog for this. But I did not know this and had spent considerable time typing each and every command into the VIM and CLI. This I wrote to save time of poor soul’s like me who are new to the Linux environment
All you need to do is copy the commnad or text you want to paste using Ctrl+C, then go the the CLI and simply press right mouse button. That’s it…it will copy your text into the terminal’s CLI.
Hey Guys, So I recently had the problem of moving from one python environment to another due to some issue with my computer. Now the problem was that I had tons of packages already installed on my python environment, now pip installing each package again would be more than a day’s task.
So I came across the use of requirements.txt file. The concept is simple – a requirements file would include all the packages and versions of the packages already installed on your working environment and giving this file to your new python environment would result in automatic installation of all packages and dependencies mentioned in the requirements file.
How do I create a requirements file?
To see all the packages already installed in your work environment, All you need to do is:
pip list
Now you can either copy all the requirements shown into a txt file or you can ask the command prompt to do it for you. If you are going for the first just copy the package names and versions into a text file like this:
Alternatively, just type this command and you will get the requirements text file generated by typing:
pip freeze > requirements.txt
This will create a requirements.txt file at your base directory. Navigate there and get the file.
Now to install the same packages from your working environment into your new environment, all you need to do is paste the requirements file you just generated into your new computer or new directory.
Open the command prompt for that python environment and navigate to the new directory where you had saved your requirements file. Then type the command below:
pip install -r requirements.txt
Any package you fail to install, just remove that from the requirements file and rerun the above command. Trust me this will save loads of your time.
Another time saver is to just remove the installed package names from your requirements.txt file. This will save time by not retrying/rechecking to see if the package has been installed.
This helped me save loads of my time. Hope it helps you too.
Hey Guys, I recently ran into a problem while playing with Python. The output on the console was displaying the output of a previous code that I had modified. I was playing around PyQt4 to PyQt5 conversion of Sentdex’s PyQt4 YouTube tutorial right here. Everythng went fine until I tried to print the entire page on the console..See the tragic buggy code below:
import bs4 as bs
import sys
import urllib.request
from PyQt5.QtWebEngineWidgets import QWebEnginePage
from PyQt5.QtWidgets import QApplication
from PyQt5.QtCore import QUrl
class Page(QWebEnginePage):
def __init__(self, url):
self.app = QApplication(sys.argv)
QWebEnginePage.__init__(self)
self.html = ''
self.loadFinished.connect(self._on_load_finished)
self.load(QUrl(url))
self.app.exec_()
def _on_load_finished(self):
self.html = self.toHtml(self.Callable)
print('Load finished')
def Callable(self, html_str):
self.html = html_str
self.app.quit()
def main():
page = Page('https://pythonprogramming.net/parsememcparseface/')
soup = bs.BeautifulSoup(page.html, 'html.parser')
js_test = soup.find('p', class_='jstest')
print js_test.text
#print (soup) # DO NOT DO THIS...This may kill your buffer...Commented it off for your safety
if __name__ == '__main__': main()
See the code section print (soup). I think this created the problem.
Now when I ran another code be it as simple as print(“Hello”) on VS code, the output I got was :
Load finished
Look at you shinin!
Press any key to continue . . .
The uniqueness of this problem was that I only faced this problem on my VS Code IDE only. Execution on direct Anaconda console did not show this issue.
I searched the entire web, but did not find any solution.
I tried to reboot. Tried to flush the buffer. Nothing helped.
Finally, out of desperation, I went on a deletion spree. I manually went inside the temp files in C:\Users\xxx\AppData\Local and started a deletion rampage…removed many files and folder remotely related to python,vscode and conda.
This gave an error warning the first time I executed my program again…then on subsequent run…the issue was resolved…my python is back to its normal self again…
I was surprised that I was not able to find any solution on the net for this. This inspired me to start my own blog to record the problems I face, especially as a noob in Python.