Since minted package requires access to the shell, this should be permitted within your editor. To do so, you have to add -shell-escape to your command list for LaTex, PdfLaTex, XeLaTex, and LuaLaTex in your editor. In “TexWorks” modify those commands by going into “Options > Configure TexWorks > Commands” change the following commands by adding -shell-escape:
latex.exe -shell-escape -src -interaction=nonstopmode %.tex
pdflatex.exe -shell-escape -synctex=1 -interaction=nonstopmode %.tex
xelatex.exe -shell-escape -synctex=1 -interaction=nonstopmode %.tex
lualatex.exe -shell-escape -synctex=1 -interaction=nonstopmode %.tex
TeXworks with pdflatex and shellescape enabled

The console will show \write18 enabled once the above is run on a file
OR
You can also save the code in a tex file (let’s say you named it testMinted.tex), and compile it from command line by going in to the folder where the file resides (let’s say it is in C:\Users\uqapourm\Desktop\testMinted) and running pdflatex.exe -shell-escape -synctex=1 -interaction=nonstopmode testMinted.tex in the command line.
SECURITY
Sometimes, it is useful to be able to run external commands from inside the tex file : it allows for example to externalize some typesetting, or to use external tools like bibtex. This is available via the \write18 tex primitive.
The problem is that it allows for almost everything.
A tex file is meant to be portable, and one shouldn't have to fear any security issue when compiling a third-party file. So by default, this primitive is disabled.
If an user needs to use it, he needs to explicitely tell the compiler that he trusts the author of the file with shell interaction, and that's exactly the point of the optional --shell-escape argument.
For years \write18 has been used as a back door to the operating system. Syntactically TeX treats it as writing to a file, but register 18 is treated as a pre-opened file that in fact executes commands.
"unrestricted" write18 means that you can execute any command so if you allow this and run a TeX file that someone sent you it may execute arbitrary code, email your password file to a spam bot or whatever.
That is obviously a security risk but there are some commands that are naturally part of the Tex distribution that you might want to always allow (such as image and font conversion) so web2c allows you (or the texlive maintainers by default) to set up a set of "allowed, safe" commands and these are allowed to run in restricted mode.
The third alternative is never to execute commands at all from \write18.
What does "restricted \write18 enabled" mean and why does TexLive keep reporting it?
How to enable shell-escape in TeXworks?
PS
Sometimes, you need to clear the cache in order to get the package to work. This will slow down the operation, but it will avoid errors. To do so, add option to \usepackage[cache=false]{minted}.
--shell-escapeoption to pdflatex to allow it to run pygmentize – David Carlisle Dec 24 '19 at 11:42--shell-escape. Can you help me out with that as well !? Thanks for the swift response! – Rajath Kashyap Dec 24 '19 at 11:45latex -shell-escape filename.tex– MadyYuvi Dec 24 '19 at 11:51pdflatex yourfile.texdopdflatex --shell-escape yourfile.texIf you get an editor to type the command for you you will need to edit the configuration in the editor, but I would just type the command directly on the commandline. – David Carlisle Dec 24 '19 at 11:56Fatal error occurred, no output PDF file produced! Transcript written on "file name.log"– Rajath Kashyap Dec 24 '19 at 12:14