execute a deletion command in sublime text's build command? - sublimetext3

So I am using sublime text 3 and I have the following build system to remove the existing executable then build then run, but it seems deletion command is not working. So is there a way to actually do this command in the build system?
{
"cmd": ["del", "${file_base_name}","&", "g++", "${file}", "-std=c++11", "-o", "${file_path}/${file_base_name}", "&", "start", "cmd", "/c", "${file_base_name} & echo. & pause"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"shell": true,
"encoding":"utf-8",
}

I found the problem by myself. In win32 you should delete "${file_base_name}.exe rather than "${file_base_name}.
hope this can help others.

Related

How do I turn on word wrap for Output window in VS code?

I'm running my code using the extension "Code Runner" and would like the output to be displayed word-wrapped. Currently when I run it, it displays the output all in a single line even if it's a long line.
I tried the setting "editor.wordWrap": "on".
This is how the output and editor look like:
Try adding this to your settings:
"[Log]": {
"editor.wordWrap": "on"
}
You can instead use the built-in debugger configuration for Python and set in launch configuration to use the "internalConsole"
{
"name": "run-test-py",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/myfile.py",
"console": "internalConsole"
},
so that the output appears in the Debug Console panel. The word wrapping for that panel is controlled by the Debug > Console: Word Wrap setting:
Set it to true:
"debug.console.wordWrap": false,
For the Debug Console you can use "debug.console.wordWrap": false,//default:true which was added in June 2019 with issue 72210

Input functionality is not working with python in Vscode

Description:
I'm using Vscode Studio for python coding, I've installed every extension related to python and I wanna use Jupyter. I'm experiencing no problem with importing packages or running code but when I try to grab the input from the user it throws me an error stating 'StdinNotImplementedError: raw_input was called, but this frontend does not support input requests.' which I don't find using the console.
[Image Error]
https://i.stack.imgur.com/BDUC5.jpg
Error
StdinNotImplementedError Traceback (most recent call last)
in
9 while 1:
10 #ask for new item
---> 11 new_item=input("> ")
12 #add new items to our list
13 shopping_list.append(new_item)
~\AppData\Local\Programs\Python\Python37-32\lib\site-packages\ipykernel\kernelbase.py in raw_input(self, prompt)
846 if not self._allow_stdin:
847 raise StdinNotImplementedError(
--> 848 "raw_input was called, but this frontend does not support input requests."
849 )
850 return self._input_request(str(prompt),
StdinNotImplementedError: raw_input was called, but this frontend does not support input requests.
Steps Taken:
Use the raw_input function instead of input.
Install and uninstall python and jupyter extension.
Checked the version of jupyter notebook --version (5.7.4) and python -m ipykernel --version (7.2.0).
Restarted kernel but encounter the same error.
Observation:
The issue is not replicable when the code is executed with python integrated terminal
Please let me know if there is setting which I'm missing or is this a bug.
Ctrl + Shift + D
Environment -> Python
This creates launch.json file within a .vscode directory in the current directory
Paste the following json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config.python.pythonPath}",
"program": "${file}",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOutput"
],
"console": "integratedTerminal"
}
]}
Save the file and open python script in the editor
Start without debugging

SublimeText3 Build System for Pandoc

I am trying to create a build system to run pandoc and save as pdf using pdflatex:
{
"selector": "text.html.markdown",
"working_dir": "$file_path",
"cmd": [
"C:\\Users\\Administrator\\AppData\\Local\\Pandoc",
"-f", "markdown",
"-t", "latex",
"--pdf-engine=pdflatex",
"-s",
"-o",
"C:\\Users\\Administrator\\Desktop\\output.pdf",
"$file"
]
}
I get an "Access is denied" error and cannot figure out what's wrong:
[WinError 5] Access is denied
[cmd: ['C:\\Users\\Administrator\\AppData\\Local\\Pandoc', '-f', 'markdown', '-t', 'latex', '--pdf-engine=pdflatex', '-s', '-o', 'C:\\Users\\Administrator\\Desktop\\output.pdf', 'C:\\Users\\Administrator\\Desktop\\CP10328R-TEST.md']]
[dir: C:\Users\Administrator\Desktop]
I have confirmed that I can write a file to the desktop without any issues, so the "access is denied" error must be related to something other than the output file. I have also tested using pdflatex as the engine and I can create PDFs from LaTex without any errors using an install of Texworks on the same machine, so the issue cannot be with LaTex. Finally, I have confirmed the path to pandoc is correct.

Install lisp kernel in IPython

I'm trying to install cl-jupyter. (Debian)
I've done the following steps:
install gcl (apt-get install gcl)
install sbcl (apt-get install sbcl)
run command python3 ./install-cl-jupyter.py
try to run command sbcl --load ./cl-jupyter.lisp but I get the following and don't know what to do. I've tried to choose all option, but nothing happend.
Output:
This is SBCL 1.2.4.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
debugger invoked on a SB-C::INPUT-ERROR-IN-LOAD in thread
#<THREAD "main thread" RUNNING {10039CE993}>:
READ error during LOAD:
Package ASDF does not exist.
Line: 3, Column: 29, File-Position: 150
Stream: #<SB-SYS:FD-STREAM
for "file /home/ivan/all/language_packages/cl-jupyter-master/cl-jupyter.lisp"
{10039D64A3}>
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [ABORT ] Abort loading file "/home/ivan/all/language_packages/cl-jupyter-master/./cl-jupyter.lisp".
1: [CONTINUE] Ignore runtime option --load "./cl-jupyter.lisp".
2: Skip rest of --eval and --load options.
3: Skip to toplevel READ/EVAL/PRINT loop.
4: [EXIT ] Exit SBCL (calling #'EXIT, killing the process).
(SB-C:COMPILER-ERROR SB-C::INPUT-ERROR-IN-LOAD :CONDITION #<SB-INT:SIMPLE-READER-PACKAGE-ERROR "Package ~A does not exist." {10039D9E83}> :STREAM #<SB-SYS:FD-STREAM for "file /home/ivan/all/language_packages/cl-jupyter-master/cl-jupyter.lisp" {10039D64A3}>)
update file ipython/your_kernel_name/kernel.json
from
{"language": "lisp", "display_name": "SBCL Lisp", "argv": ["sbcl", "--non-interactive", "--load", "/home/ivan/all/language_packages/cl-jupyter-master/cl-jupyter.lisp", "/home/ivan/all/language_packages/cl-jupyter-master/src", "/home/ivan/all/language_packages/cl-jupyter-master", "{connection_file}"]}
to
{
"argv": [
"sbcl","--non-interactive", "--load",
"/path/to/cl-jupyter/cl-jupyter.lisp",
"/path/to/cl-jupyter/src",
"/path/to/cl-jupyter",
"{connection_file}"
],
"display_name": "SBCL Lisp",
"language": "lisp"
}
(information from here)
Now I can see the SBCL Lisp kernel in jupyter but it doesn't work and breaks all the time when I try to write and run smth.
Please, help
I've done it! Now it works fine.
1)I forgot to install quicklisp
2) here i just put right paths to cl-jupyter.lisp, /src, /cl-jupyter:
{
"argv": [
"sbcl","--non-interactive", "--load",
"/path/to/cl-jupyter/cl-jupyter.lisp",
"/path/to/cl-jupyter/src",
"/path/to/cl-jupyter",
"{connection_file}"
],
"display_name": "SBCL Lisp",
"language": "lisp"
}

Fix substitution of “shell_cmd” on Mac OSX in Sublime Text 3

I have a problem with my build system specified in project settings. Currently my project settings look like this
{
"build_systems":
[
{
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"name": "Anaconda Python Builder",
"selector": "source.python",
"shell_cmd": "$project_path/bin/python -u $file"
}
],
"folders":
[
{
"file_exclude_patterns":
[
"pip-selfcheck.json",
"pyvenv.cfg"
],
"folder_exclude_patterns":
[
"lib",
"include",
"bin"
],
"follow_symlinks": true,
"path": "."
}
],
"settings":
{
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
"*.tga",
"*.dds",
"*.ico",
"*.eot",
"*.pdf",
"*.swf",
"*.jar",
"*.zip",
"client/node_modules/**",
"data/**"
]
}
}
The actual problem problem is in the line:
"shell_cmd": "$project_path/bin/python -u $file"
Every time I close sublime and reopen it my shell_cmd gets substituted with this
"shell_cmd": "\"python\" -u \"$file\""
Which fails my build. Is there a way to fix this problem? What do I do to disable this automatic substitution?
Mac OS X 10.11.3
Sublime Text 3103
I already answered this question in the Anaconda's issues tracker but I will do it here for any other user that lands in this question with a similar problem.
That specific build system is used by Anaconda itself and that is why it is called "Anaconda Python Builder", it will update the "shell_cmd" with anything that you used as configuration for your "python_interpreter" setting into your anaconda's settings file (general, user or per project).
If you have specific needs for your build system, you should create a new build entry with your own options and stick to that one. Anaconda's build system is a convenience for users that need to use their configured Python interpreter instead of the embedded ST3 one.
I solved this issue without a custom build system by adding python_interpreter: 'full/path/to/python' to the settings dictionary. python part in the Anaconda Python Builder shell_cmd gets replaced with it.

Resources