foreshadow / atom-python-run Goto Github PK
View Code? Open in Web Editor NEWA simple atom package. Press one key to run your python code in atom.
Home Page: https://atom.io/packages/atom-python-run
License: MIT License
A simple atom package. Press one key to run your python code in atom.
Home Page: https://atom.io/packages/atom-python-run
License: MIT License
Hi
I have a simple 'hello-world' python script
When I hit F5 I see popups telling me that the script is being run, however, I see no output
How do I turn the output on?
Thanks
When running programs, they do not run locally. On my machine, the following program reports that it runs from my Downloads folder, rather than the project folder.
from os import getcwd
print(getcwd())
Can anyone reproduce?
Opens two different consoles when pressing either F5 or F6
The running command could be configurable.
For example, use the pypy.exe
instead of python.exe
.
There could be two different setups for the different function keys (F5 and F6). I can imagine something like this for F6:
python.exe -O -m compileall ./{FILENAME}.py
python.exe {FILENAME}.pyo
Any possibility of making this available for mac?
Editor's split view causes python script run twice. This issue appeared on recent update (0.5.2)
I install it and find I don't know how to use it.
Hey bro!
I've added python to my PATH but the error is still "cmd can't spwan...."
using latest version
py - 3.5
Hi,
I searched the web and tried many things before contacting you..
Even though I change "F5 command" to "python3 {file}" I can't seem to have it working properly.
When hitting F5, I get the attached message in the terminal.
I can have Geany working properly with python3. But I would rather be using Atom with your package.
Anything you can do will be most welcomed.
Thanks,
Frederic
As the command for F6, I put as:
python.exe "{file}" > output.txt
There is an empty text file "output.txt" created in the current directory. Output of the given input is displayed right away in the command prompt but not in the wanted file. Kindly tell me if I am missing something here.
Great work btw
大神你好
我在設定的 Command 中輸入 python -i "{file}"
只要沒有英文以外的語言
跳出 cmd 並執行程式,一切都很完美
可是,遇到中文就會有亂碼問題了
我嘗試在那一行中輸入兩個指令 chcp 65001 && python -i "{file}"
但卻只會執行 chcp 65001
這時,我就想起 python 自帶的 IDLE
它長得像這樣
於是我就在 command 中輸入 python -m idlelib "{file}"
以為它可以用 python shell 直接幫我執行 script ,結果並不然
它用 IDLE 開啟了我的檔案,我還得手動按 F5 執行
我已經用 Atom 了,應該是不需要再開個 IDLE 才對_( : |
所以現在想到的兩種解決方法都卡在其中一步
我的問題大概是這樣,想請教一下有什麼解法嗎
非常感謝 :)
TL;DR
i just want to make sure the code for terminal
is readable and maintainable. not sure how to go about it. especially since i have more experience with Python than JS. i'll also be adding some documentation for cp
and terminal
to help others understand how the code works.
explanation
the terminal.js
module is something i quickly hacked together to create cross platform capability for the atom-python-run
module.
i'm in the midst of refactoring the terminal.js
module and i'm just not sure how to do it and might require a live coding session.
i also have an idea for fixing the absolute path issue; that way it can be relative or absolute depending on the situation in relation to an issue mentioned in issue #44.
so i've decided to new this as an issue hoping to resolve it.
over the next few days, or even weeks, depending on how much time i'm able to invest in to this, i will be proposing models to help resolve it.
these models may be pictorial or actual code that i've written in a separate branch. most of the code displayed here may or may not be used at all.
looking over the code, it's quite disturbing to look at and difficult to decipher; some of which was unfortunately unavoidable. it was either a switch
statement or a long series of branching
statements. either of which, the switch
still seems to be a better choice. i'm also accustomed to thinking in terms of classes, not functional, prototypical, objects.
i'm very inexperienced in functional programming languages, so JS seems to challenge me in that regard and i'm currently not up to the challenge. after this issue is resolved, and making some minor changes or enhancements to cp
, i've decided i'll be moving on to other ventures that will inevitably take up much of my time and attention.
before i move on, i do hope to leave behind enough information to break down both cp
and terminal
so that they can effectively be maintained.
Personal Comment
I've been looking at the source code for awhile and after breaking it down to it's core, I see no reason why this application shouldn't be Cross Platform Compatible. The use of the cp.exe is redundant and unnecessary.
Rationale
In the atom-python-run.js source file, you use 2 key modules
const path = require("path");
const child_process = require("child_process");
The Quick and Dirty Solution would be to utilize the built in process
object which could be used as such to determine the type of OS
process.env.PATH[0]
*nix Output: `/`
Windows Output: `x`
This will output either a /
for a *nix based environment or a x
where x is a drive letter corresponding to the mounted file system in Windows.
cp
just adds another layer to the child_process.spawn()
method. They essentially behave the same since they both execute a command and create a process.
Considerations About the Program cp
You bypass python by chaining the execution process from atom
to node
to cp
to python
. The chained process should have been from atom
to node
to python
directly regardless of the OS in use.
The cp
executable adds complexity to your simple application and locks it in to one environment without any further consideration of the simple implications that it raises.
Using cp
creates a security hole that allows ANY command to be executed in the environment because of the fact that there is no sanitization as the Child Process documentation repeatedly suggests. cp
takes ANY set of arguments, concatenates them, and then passes them directly to the system()
function without further consideration.
At this point, so the End User never has to worry, you really only require that python
and idle
be available in the PATH
variable which is universal. Syntactically speaking, the only differences are in how the tokens are parsed and delimited.
Windows: c:\some\path\to\some\binary.exe; c:\some\other\binary.exe; ...etc
*nix: /some/path/to/some/binaries: /some/other/binaries: ...etc
Proposal
There is no real need or requirement for the cp.cpp file (which is pure C and could be a *.c source file as well). The best solution is to dump it. It creates a complicated set of instructions for the run(command)
function which is what actually spawns the python process in the first place. This also solves the cross compilation issues that arise from utilizing cp
as a mechanism in your tool chain.
You can use the fact that node.js is built in to Atom to your advantage and create conditional statements for each environment.
process.platform
Windows Output: win32
Mac OS X Output: darwin
Linux output: linux
from there, you can utilize javascripts branching mechanisms to decide how you want to spawn a process. for example, if I want to spawn a python file in Linux, all I have to do is this.
var child = child_process.spawn(ca[0], [
ca[1]
], {
cwd: info.dir,
detached: true
});
child.unref();
This bypasses cp
completely and succeeds in executing the child process while unreferencing it so that it is no longer attached to its parent process, Atom. This also allows you to create custom events for specific environments.
Solution
To add cross platform compatability, all you have to do is delete the bin
directory and the src
directory. In the lib
directory, edit the atom-python-run.js
source file so that it reflects the changes below.
First, change the f5_command
and f6_command
properties to execute python. There is no need to add the file extension *.exe
. The OS will do the right thing when it has to.
// OS doesn't need the file extension for python executable
f5_command: {
title: "Command of F5",
description: "{file} stands for current file path",
type: "string",
default: "python \"{file}\""
},
f6_command: {
title: "Command of F6",
description: "{file} stands for current file path",
type: "string",
default: "python \"{file}\""
},
Modify the function run(command)
so that it has these statements at the end of the block instead.
var child;
// if Windows OS
if ("win32" === process.platform) {
child = child_process.spawn("cmd", [
"/c", "start", ca[0] + ca[1]
], {
cwd: info.dir,
detached: true
});
}
// if Mac OS X or Linux
if ("darwin" === process.platform || "linux" === process.platform) {
child = child_process.spawn(ca[0], [
ca[1]
], {
cwd: info.dir,
detached: true
});
}
child.unref();
It's simple and it turns out it wasn't all that bad after all.
Any bugs caused by these branches can be reported and easily tweaked so that they behave as expected.
This also creates explicit calls so that only the desired file is executed within the environment and the worry of unsanitised execution is non-existent because cp
is no longer necessary which negates any worries of cross compilation as well.
Additional Comments
Seeing as the the execution time is calculated within the cp
executable and utilizes the DOS command pause
, you can simply tell the user to append the built in input()
command at the end of the python source file so that the shell stays open. If the End User is interested in timing the execution process, they can do so by implementing a built in method provided by the python library.
Python 2.x.x
raw_input("press any key to continue...")
Python 3.x.x
input("press any key to continue...")
This will allow the shell to say open until the user decides to close it.
Sorry for disturbing your use.
This bug has been reported several times, #10 #12 #15 #16.
Not until now was the reason of multiple consoles bug found, which is the relation with key input and function call is not correctly disposed when the package is disabled. And when it is activate again, the relation will be registered a second time which cause double consoles. (If you turn off and turn on the package several times, multiple consoles will be shown when you hit F5
or F6
)
This will typically happen after installing an update, but it will work normally when you restart atom and don't disable/enable this package.
However, for some reason, it can not be fixed in a single update. And if it is not updated, this bug will not easily happen.
I am keeping the latest code in local until the next bug fix version is released.
And when the next version(probably v0.6.3 or v0.7.0) releases, this will happen again because of the old version that you have already installed. But I believe it is not happening again in versions afterwards.
It is my first atom package. Because of my negligence, I did not fully understand the operating mechanism of atom package before, which caused this bug to last for such a long time.
I feel sorry again for the inconvenience it has troubled you.
[Enter steps to reproduce:]
Atom: 1.15.0 x64
Electron: 1.3.13
OS: Ubuntu 16.04.2
Thrown From: atom-python-run package 0.7.3
Uncaught Error: EACCES: permission denied, open '/tmp/mozilla_carreira0/plot_digits_classification.py'
At /usr/share/atom/resources/app.asar/node_modules/text-buffer/lib/text-buffer.js:1076
Error: EACCES: permission denied, open '/tmp/mozilla_carreira0/plot_digits_classification.py'
at Error (native)
at Object.fs.openSync (fs.js:640:18)
at Object.module.(anonymous function) [as openSync] (ELECTRON_ASAR.js:168:20)
at Object.fs.writeFileSync (fs.js:1343:33)
at Object.writeFileSync (/app.asar/node_modules/fs-plus/lib/fs-plus.js:281:17)
at File.module.exports.File.writeFileSync (/app.asar/node_modules/text-buffer/node_modules/pathwatcher/lib/file.js:285:19)
at File.module.exports.File.writeFileWithPrivilegeEscalationSync (/app.asar/node_modules/text-buffer/node_modules/pathwatcher/lib/file.js:463:21)
at File.module.exports.File.writeSync (/app.asar/node_modules/text-buffer/node_modules/pathwatcher/lib/file.js:380:12)
at TextBuffer.module.exports.TextBuffer.saveAs (/app.asar/node_modules/text-buffer/lib/text-buffer.js:1067:19)
at TextBuffer.module.exports.TextBuffer.save (/app.asar/node_modules/text-buffer/lib/text-buffer.js:1048:19)
at TextEditor.module.exports.TextEditor.save (/app.asar/src/text-editor.js:915:26)
at run (/packages/atom-python-run/lib/atom-python-run.js:67:12)
at /packages/atom-python-run/lib/atom-python-run.js:49:5)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/app.asar/src/command-registry.js:259:29)
at /app.asar/src/command-registry.js:3:59
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:599:16)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:390:22)
at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/app.asar/src/window-event-handler.js:106:36)
at /app.asar/src/window-event-handler.js:3:59)
-2:42.3.0 core:confirm (input.hidden-input)
2x -2:34.8.0 core:backspace (input.hidden-input)
-2:31.4.0 core:confirm (input.hidden-input)
-0:06.9.0 Python run: run-f5 (input.hidden-input)
atom-python-run 0.7.3
autocomplete-fortran 0.9.4
autocomplete-python 1.8.63
dark-bint-syntax 0.10.0
Hydrogen 1.10.1
language-fortran 2.1.0
language-matlab 0.2.1
latex 0.43.0
latexer 0.3.0
latextools 0.8.5
script 3.14.1
terminal-fusion 2.4.4
Hi,
i'm trying to pass params to a script (set on F6 button):
python check.py {file}
so that Python can open my script check.py
with {file}
parameter. Unfortunately, this command only runs check.py
with no parameters received, How can I do it?
On pressing F5 or F6, cmd will open twice returning the following message in each, except with varying file names and times as appropriate, regardless of the file attempted to run.
python.exe: can't open file 'test.py': [Errno 2] No such file or directory
Process returned 2 (0x2) execution time : 0.053 s
Press any key to continue . . .
after updating from 7.4, when I press f5 to run the program a console window comes up then closes immediately.
There doesn't seem to be any error message in the window, it's just blank!
@foreshadow
I have an issue, when we have folder with a space and try to run it we have a message in terminal like this:
python.exe: can't open file 'D:\Workspace\Simple Python\': [Errno 2]
No such file or directory
My example in my directory D:\Workspace\Simple Pyhton
while I use os.getcwd() .
It returns c:\users\myusername\Appdata\Local\Atom\app-1.10.2 , not my real directory of the python file.
[Enter steps to reproduce:]
Atom: 1.15.0 ia32
Electron: 1.3.13
OS: Microsoft Windows 10 Home
Thrown From: atom-python-run package 0.7.3
Uncaught Error: UNKNOWN: unknown error, open 'C:\Users\mdpmc\Dropbox\Programing\towers_of_hanoi.py'
At C:\Users\mdpmc\AppData\Local\atom\app-1.15.0\resources\app.asar\node_modules\text-buffer\lib\text-buffer.js:1076
Error: UNKNOWN: unknown error, open 'C:\Users\mdpmc\Dropbox\Programing\towers_of_hanoi.py'
at Error (native)
at Object.fs.openSync (fs.js:640:18)
at Object.module.(anonymous function) [as openSync] (ELECTRON_ASAR.js:168:20)
at Object.fs.writeFileSync (fs.js:1343:33)
at Object.writeFileSync (/app.asar/node_modules/fs-plus/lib/fs-plus.js:281:17)
at File.module.exports.File.writeFileSync (/app.asar/node_modules/text-buffer/node_modules/pathwatcher/lib/file.js:285:19)
at File.module.exports.File.writeFileWithPrivilegeEscalationSync (/app.asar/node_modules/text-buffer/node_modules/pathwatcher/lib/file.js:463:21)
at File.module.exports.File.writeSync (/app.asar/node_modules/text-buffer/node_modules/pathwatcher/lib/file.js:380:12)
at TextBuffer.module.exports.TextBuffer.saveAs (/app.asar/node_modules/text-buffer/lib/text-buffer.js:1067:19)
at TextBuffer.module.exports.TextBuffer.save (/app.asar/node_modules/text-buffer/lib/text-buffer.js:1048:19)
at TextEditor.module.exports.TextEditor.save (/app.asar/src/text-editor.js:915:26)
at run (/packages/atom-python-run/lib/atom-python-run.js:67:12)
at /packages/atom-python-run/lib/atom-python-run.js:49:5)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/app.asar/src/command-registry.js:259:29)
at /app.asar/src/command-registry.js:3:59
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:599:16)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/app.asar/node_modules/atom-keymap/lib/keymap-manager.js:390:22)
at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/app.asar/src/window-event-handler.js:106:36)
at /app.asar/src/window-event-handler.js:3:59)
-4:53.5.0 application:add-project-folder (ol.tree-view.full-menu.list-tree.has-collapsable-children.focusable-panel)
-4:29.4.0 tree-view:add-file (span.name.icon.icon-file-directory)
-4:19.4.0 core:confirm (input.hidden-input)
-0:28 intentions:highlight (input.hidden-input)
-0:27.6.0 core:paste (input.hidden-input)
-0:24.4.0 core:backspace (input.hidden-input)
-0:22.7.0 intentions:highlight (input.hidden-input)
-0:22.3.0 core:save (input.hidden-input)
-0:21.1.0 Python run: run-f5 (input.hidden-input)
atom-monokai 0.10.9
atom-python-run 0.7.3
autoclose-html 0.23.0
autocomplete-python 1.8.62
busy-signal 1.3.0
highlight-selected 0.12.0
intentions 1.1.2
linter 2.1.0
linter-ui-default 1.2.1
minimap 4.26.8
monokai 0.22.0
pigments 0.39.1
seti-ui 1.7.0
I find the "Saving" and "Running" notifications rather annoying. For some reason I can't close them, and I have to wait until they disappear by themselves. Decided to comment them out in atom-python-run.js
Would be nice if there was an option to disable them in settings.
After updating windows, atom-python-run has stopped working. Says python.exe not found and python is installed on path so I don't know why it won't run. Ant help would be appreciated. Thanks
Hi,
I don't think it works. At least pressing F6 doesn't do a thing and I can't find the package in ctrl+p either. Maybe you can help?
INFO: Platform: darwin
INFO: Version Info: v0.2.0
DEBUG: Log Path: /Users/okarmin/.atom/packages/atom-python-run/cp.log
DEBUG: _ast: "['--pause', '/Users/okarmin/Google', 'Drive/v1.1/okarBot.py']"
DEBUG: Index: "0" Token: "--pause"
DEBUG: Index: "1" Token: "/Users/okarmin/Google"
DEBUG: Index: "2" Token: "Drive/v1.1/okarBot.py"
ERROR: Error: Expected optional option argument: got "Drive/v1.1/okarBot.py" instead
I'm update the package today, find this error!!!
BufferExceptionTypeError: Cannot read property 'then' of undefined: You failed to create the file before attempting to execute it.
[Enter steps to reproduce:]
Atom: 1.21.0 x64
Electron: 1.6.9
OS: Mac OS X 10.11.6
Thrown From: atom-python-run package 0.9.2
Uncaught TypeError: Cannot read property 'buffer' of undefined
At /Users/zenashopson/.atom/packages/atom-python-run/lib/atom-python-run.js:32
TypeError: Cannot read property 'buffer' of undefined
at run (/packages/atom-python-run/lib/atom-python-run.js:32:41)
at HTMLElement.runF6 (/packages/atom-python-run/lib/atom-python-run.js:18:13)
at CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:381:36)
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:100:42)
at HTMLDocument.<anonymous> (/Applications/Atom.app/Contents/Resources/app/src/window-event-handler.js:3:65)
5x -1:48.4.0 Python run: run-f6 (input.hidden-input)
atom-python-run 0.9.2
I'm working on a PyQt5 project and I am editing .qml files and I want to be able to hit F5
to run the application while a .qml file is open.
I thought I could just hard code the file to run, so I replaced {file}
with the .py file I want to run. But when I have a .qml file open and I press F5
it says File.qml is not a .py file, exit.
Hey there I have installed atom then installed python had a box to install into path did that and tried running a bit of code in atom and it still wont work?? help please :)
只看到写的是在WIn下,不知道Ubuntu下行不行
The error message is as follows when I press F5 to run a python file:
python /Users/spencer/.atom/packages/atom-python-run/lib/../cp/main.py --pause python /Users/spencer/PolyU/COMP5121/assignments/assignment 1/knn.py
Error: Expected optional option argument: got "1/knn.py" instead
Is there something wrong with the space parsing of the directory string?
when i press F5
it alert me " Windows cannot find ' C:\Users\Thanakit' "
My user account is Thanakit Khamhung
pls help
Steps to reproduce:
Installed python on work computer (Win7), without admin rights. However, python is still in PATH.
Attempting to run yields the following error.
The command I used to install python is:
msiexec /a python-2.7.12.msi /qb TARGETDIR=C:\Misker\python
Atom Version: 1.8.0
System: Microsoft Windows 7 Professional
Thrown From: atom-python-run package, v0.2.0
Uncaught TypeError: Cannot read property 'path' of null
At C:\Users\mhb1115\.atom\packages\atom-python-run\lib\atom-python-run.js:13
TypeError: Cannot read property 'path' of null
at atom-text-editor.run (C:\Users\mhb1115\.atom\packages\atom-python-run\lib\atom-python-run.js:13:64)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\mhb1115\AppData\Local\atom\app-1.8.0\resources\app.asar\src\command-registry.js:260:29)
at C:\Users\mhb1115\AppData\Local\atom\app-1.8.0\resources\app.asar\src\command-registry.js:3:61
at CommandPaletteView.module.exports.CommandPaletteView.confirmed (C:\Users\mhb1115\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\command-palette\lib\command-palette-view.js:183:32)
at CommandPaletteView.module.exports.SelectListView.confirmSelection (C:\Users\mhb1115\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\atom-space-pen-views\lib\select-list-view.js:338:21)
at space-pen-div.atom.commands.add.core:confirm (C:\Users\mhb1115\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\atom-space-pen-views\lib\select-list-view.js:109:19)
at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (C:\Users\mhb1115\AppData\Local\atom\app-1.8.0\resources\app.asar\src\command-registry.js:260:29)
at C:\Users\mhb1115\AppData\Local\atom\app-1.8.0\resources\app.asar\src\command-registry.js:3:61
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (C:\Users\mhb1115\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:580:16)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (C:\Users\mhb1115\AppData\Local\atom\app-1.8.0\resources\app.asar\node_modules\atom-keymap\lib\keymap-manager.js:388:22)
at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (C:\Users\mhb1115\AppData\Local\atom\app-1.8.0\resources\app.asar\src\window-event-handler.js:98:36)
at HTMLDocument.<anonymous> (C:\Users\mhb1115\AppData\Local\atom\app-1.8.0\resources\app.asar\src\window-event-handler.js:3:61)
6x -2:17.8.0 core:backspace (atom-text-editor.editor.mini.is-focused)
-2:15.7.0 core:confirm (atom-text-editor.editor.mini.is-focused)
-0:42.9.0 core:select-all (atom-text-editor.editor.is-focused)
-0:42.9.0 editor:delete-to-beginning-of-word (atom-text-editor.editor.is-focused)
-0:42.8.0 core:backspace (atom-text-editor.editor.is-focused)
-0:41.1.0 grammar-selector:show (atom-text-editor.editor)
-0:38.1.0 core:confirm (atom-text-editor.editor.mini.is-focused)
-0:36 core:backspace (atom-text-editor.editor.is-focused)
-0:33.4.0 core:save (atom-text-editor.editor.is-focused)
-0:31.1.0 command-palette:toggle (atom-text-editor.editor.is-focused)
-0:28.8.0 core:confirm (atom-text-editor.editor.mini.is-focused)
-0:28.8.0 atom-python-run:run (atom-text-editor.editor)
-0:17.2.0 command-palette:toggle (atom-text-editor.editor.is-focused)
-0:13.4.0 core:confirm (atom-text-editor.editor.mini.is-focused)
-0:13.4.0 Python run: run (atom-text-editor.editor)
{}
# User
atom-python-run, v0.2.0
# Dev
No dev packages
[Enter steps to reproduce:]
Atom: 1.22.1 x64
Electron: 1.6.15
OS: Microsoft Windows 10 Enterprise
Thrown From: atom-python-run package 0.9.4
Uncaught Error: Can't save a buffer with no file
At C:\Users\Rishab\AppData\Local\atom\app-1.22.1\resources\app\node_modules\text-buffer\lib\text-buffer.js:1267
Error: Can't save a buffer with no file
at TextBuffer.module.exports.TextBuffer.saveTo (~/AppData/Local/atom/app-1.22.1/resources/app/node_modules/text-buffer/lib/text-buffer.js:1267:21)
at TextBuffer.module.exports.TextBuffer.save (~/AppData/Local/atom/app-1.22.1/resources/app/node_modules/text-buffer/lib/text-buffer.js:1251:25)
at TextEditor.module.exports.TextEditor.save (~/AppData/Local/atom/app-1.22.1/resources/app/src/text-editor.js:1018:32)
at Object.saveAndRun (/packages/atom-python-run/lib/atom-python-run.js:18:50)
at CommandRegistry.handleCommandEvent (~/AppData/Local/atom/app-1.22.1/resources/app/src/command-registry.js:381:36)
at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (~/AppData/Local/atom/app-1.22.1/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:621:22)
at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (~/AppData/Local/atom/app-1.22.1/resources/app/node_modules/atom-keymap/lib/keymap-manager.js:412:28)
at WindowEventHandler.module.exports.WindowEventHandler.handleDocumentKeyEvent (~/AppData/Local/atom/app-1.22.1/resources/app/src/window-event-handler.js:100:42)
at HTMLDocument.<anonymous> (~/AppData/Local/atom/app-1.22.1/resources/app/src/window-event-handler.js:3:65)
2x -0:53.7.0 core:backspace (input.hidden-input)
-0:30.1.0 autocomplete-plus:confirm (input.hidden-input)
-0:27.7.0 editor:newline (input.hidden-input)
-0:24.2.0 Python run: run-f5 (input.hidden-input)
atom-python-run 0.9.4
autocomplete-python 1.10.3
Hi! Thanks for maintaining the atom-python-run package!
In Atom v1.19, we will release a major change to Atom's core text buffer data structure. As part of this change, we have made TextBuffer.save
asynchronous; rather than blocking until the save is complete, it now immediately returns a Promise
that resolves when the save is complete. Because of this, a few other Atom APIs that use save
have similarly become async:
Pane.close
TextBuffer.save
TextEditor.save
Pane.saveItem
Pane.saveItemAs
Pane.saveActiveItem
Pane.saveActiveItemAs
Pane.saveItems
Workspace.saveActivePaneItem
Workspace.saveActivePaneItemAs
We think this package could be impacted by this upgrade because it calls the changed methods in the following places:
TextEditor.save
We found these calls using a regex search, so this list might be incomplete, and it might contain some false positives.
It should be pretty easy to adjust your package code and/or tests to work with the new async behavior, and to simultaneously keep it working with older versions of Atom. Here are some examples of pull requests we opened on our bundled packages to cope with the change:
Please let me know if you have any questions. I'd be happy to help!
CMD不太好看
I keep getting cmd could not be spawned, although python is in my path. I am on windows 8.1 using python 3.6.1
Hi,
I use this add-on extensively on my main tower PC, yet on a new laptop i recently purchased, this add-on will now work. Once F5/F6 is pressed an error message pops up as follows:
"Windows_ can not find 'python'. Make sure you typed the name correctly, and then try again"
I have installed python in the laptop, yet this error still occurs.
Looking forward to hearing back soon,
John Fletcher
As the titlle says, I think it would be cool to warn user about the terminal settings on errors, instead of showing an exception from the Spawner.
I'm running Python 3.5, upon pressing F5 or F6, a command prompt pops up but immediately closes. I tried halting the process with a basic k = input("Press any key to close")
but that didn't seem to work.
I was thinking maybe we could keep running code in the python shell after the script has been run. So for example let's say I have a couple of definitions I want to work with inside the python script, and let's say that it's a nested dictionary object loaded from json text. I think I would want to be able to continue interacting with the shell to continue navigating through my own code and testing it.
For example:
The python script:
the_json = dict
The shell:
the_json[key][key][key][key][some index #][key][key]
error message or object being returned
And maybe instead of ending the shell right away, we could exit the shell through the ESC key or ctrl+w would be nice.
I use cmder, which is a popular console emulator for Windows based on ConEmu.
Currently, I am using cmder as my default command prompt - it normally opens instead of the ordinary Windows Command Prompt whenever I use an application that requires a prompt.
The only case where it doesn't launch by default is through atom-python-run - and this is what I see as an issue. Anyone know how this could be fixed?
atom上显示的是0.7.0,下载链接:https://www.atom.io/api/packages/atom-python-run/versions/0.7.0/tarball ,直接404 not found了
应该是0.6.0或者0.5.2吧
Had been using the plugin for a while without a problem, but today the commands stopped working when Pause is deactivated.
No error message is thrown but sometimes the mouse cursor shows activity after pressing the command keys.
It works perfectly when Pause is activated
I'm using Windows 10
Is it possible to run *.pyw without console window?
in
atom-python-run.js
changes have been made to run, but it's still running via python.exe instead of pythonw.exe
...
if (info.ext != ".py" && info.ext != ".pyw") {
notification("warning", format("{0} is not a .py file, exit.", [info.base]));
return;
}
...
f6_command: {
title: "Command of F6",
description: "{file} stands for current file path",
type: "string",
default: "pythonw.exe \"{file}\""
}
for some reason after I updated it opens multiple instances of cmd prompt when I run a python script
Hey,
I don't want to sound like an idiot, but where exactly to I put the path to Python Launcher. Also, will this still work even though i'm using macOS?
Thanks,
Lambo.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.