I've updated to octave 4.1.0+ on my mac via homebrew.
Two (related?) problems that I'm seeing:
Now when I type octave on a command line the Octave GUI opens fine, but I don't seem to be able to open any files (.m or otherwise). When I double-click a file nothing seems to happen, and there are no messages on the command line window, even if I use the --verbose switch to start it up.
When I try to close the GUI's window, octave just blocks, and the only way I can get it to close is to kill the process on a command line.
How can I debug this to understand what's going on?
Related
I am used to being able to force-stop the running of a selection of code. This is possible in vscode and Spyder without losing the variables in memory.
Example from Spyder, which is using iPypthon console: you run a command with the same "Run selection or current line" (in Spyder: F9) process, you realise that it takes too long and you want to stop it. You simply use "Stop current command" (red square).
After the stop, the memory is not lost, all variables are still in memory that have been known at the stop moment. Proof:
When you go on in Spyder, you can choose whatever code line that has been passed till the stop moment to go on with (you can also choose later code lines, but that usually makes no sense). For example, if you stop a long running loop, change the code of that loop and then run it again, or you go back 10 code lines to start from there instead.
You are simply free to go on from any code line to execute a new selection.
In Contrast, in PyCharm, I only find the red square "Stop Console" which stops the console completely, no action possible after this, all variables in memory are lost.
After pressing the red square or pressing Ctrl+C in the "Python Console" the console is closed.
The console prints
Process finished with exit code 0
and no input is possible anymore. After this stop, there is also no option anymore to "Execute Selection in Python Console" (Shift+Alt+E) either, it leads to:
"Rerun" / "New Console" both restart the kernel, the variables in memory are lost:
Using iPython console instead of the standard Python console (you can install this under [File>Settings>MyProject>Project Interpreter], see How To Add The IPython Console To PyCharm), same issue:
And this happens even though in Spyder, which uses iPython, a "stop" puts me back to the iPython shell without losing the variables in memory. I guess that this thread Can I stop execution of current module in ipython without leaving ipython is about a similar problem, though not paticularly related to PyCharm.
How can I get a stop option in PyCharm that is similar to the "Stop current command" option of Spyder so that the "stop" keeps the variables in memory and I can go on from where it has stopped?
Mind that the thread Keyboard interrupt in debug mode PyCharm is not a duplicate of this, since its accepted answer leads to a closed kernel as well.
While it is possible in PyCharm to pause the script when running via the run/debug configuration, unfortunately the "pause" action is not available when running a selection in console, neither is the "stop" button you've requested. The current implementation of the "stop" button sends SIGTERM/SIGKILL.
A feature request has been created for this issue: https://youtrack.jetbrains.com/issue/PY-44346
Debugger has the pause action, which can be accessed from the toolbar, or from the menu.
https://www.jetbrains.com/help/pycharm/pausing-and-resuming-the-debugger-session.html
The only option here would be to use breakpoints. You can add them by clicking the area to the right of the line number.
Credit: How to pause script execution in PyCharm Community?
How to pause program execution in Pycharm (pause button not working)?
I am invoking the following from a windows service under Windows 10 or Windows Server 2012 (C# program that shells out to execute the command), but nothing is being printed. I can copy and paste the command being sent into a command prompt, but it pops up a print dialog and I have to click ok for the file to print (which it does). What switch do I need to add such that the dialog won't come up and the file will be printed directly without user intervention since the intention is for this to work unattended as a windows service? This is ghostscript 9.50, which is the latest as of today. In an earlier version of ghostscript this worked if the device was set to ljet4 but this was causing an error with 9.50. Also, the output file did not have the %printer% prefix on the outputfile and previously it was prefixed with \\spool\. I have tried all of these combinations. Is it the mswinpr2 that is causing the unwanted dialog? I'm guessing this is what is preventing the printing to occur.
gswin64c -dPrinted -dBATCH -dNOPAUSE -dNOSAFER -q -dNumCopies#1 -sDEVICE#mswinpr2 -sOutputFile#"%%printer%%HP LaserJet Professional P1109w" "\\2-DYQJKC2\c$\Webs\myfolder\Public\Reports\HIPAACert\189\H01519447A2191016103332.pdf"
The mswinpr2 device needs to be able to select the Windows printer, yes. If it cannot for any reason (mistyping the printer name is a classic reason for example) then it will pop up the printer selection dialog. It has to otherwise it doesn't know where to send the output. I'd have to guess this is your problem (nothing to do with adding extra switches)
You should be using %printer% from the command line, you only need to double the % in a batch file, because batch file processing tries to interpret the % so you have to escape it. So if you are doubling the % in the command line then yes, it will indeed pop up a dialog box, because %printer% is not the same as %%printer%% so Ghostscript won't recognise this as a printer.
I'd suggest that you keep on working from the command line until you get a result, so don't double up the %.
Other than that, its difficult to comment. Do you get anything on the back channel (you'll want to drop the -q while debugging too) ? Obviously I'm not sitting in front of your system, so I can't see what the printer is called.....
FWIW I tried it here with the "Adobe PDF" printer and it works, but using the "Microsoft XPS Document Writer" does not, and in fact even selecting that from the dialog fails "Unable to open the initial device".
[edit]
A little debugging later....
The function DocumentProperties() fails with the Microsoft XPS Document Writer. I suspect this is because the printing system on Windows was significantly reworked for Vista and above, and Windows 10 does away with much of the legacy code. I suspect this old Win32 API call simply doesn't work with newer devices.
If your printer works when you select it from the print dialog, however, this is not the same problem. For me this printer fails even when selected from the print dialog. Seems its just not compatible with the old Win32 API.
NB this also displays the error "Printer StartDoc failed (error 00000006)".
So I still suspect that you have some problem with the printer name. Maybe a quick test would be to set the name to something really simple like '"Printer1' and try that.
I can't think of anything which has changed in the ljet4 device which would cause a problem, you don;t say what the error is, or even where it occurs, on the printer or reported by Ghostscript, so there's really nothing I can offer on that front.
I recently ran into the same issue. I added a -dQueryUser=3 argument. The documentation on the use of -dQueryUser=N can be found at:
https://www.ghostscript.com/doc/9.25/Devices.htm#Win
in the
10.2 Supported options (device properties)
section.
The code that illustrates this, in a batch file on Windows 10, is:
SET MY_EXECUTABLE_PATH=C:\Program Files\gs\gs9.53.3\bin
for %%i in (*.pdf) do "%MY_EXECUTABLE_PATH%"\gswin64c.exe -sDEVICE=mswinpr2 -dBATCH -dNOPAUSE -dPDFFitPage -dQueryUser=3 -sOutputFile="%printer%Printer_Name" "%%i"
I am having problems saving the Python code in Anaconda. I write code, Go to File Save as the file is saved but when I open it is empty, no code. I read that IDLE does not save code, it erases it when I close Anaconda.
I have searched in books, youtube tutorials and nothing. I could not find this topic. I can find advanced topics, but this one no.
Thank you for your help!
Best,
Tiberiu
This somewhat depends on what OS you are on. I can speak from my experience. I would highly recommend using PyCharm as an IDE.
But more fundamentally than that, lets talk about saving files. On Mac OS X or Ubuntu 14.04 (or the like), lets say you want to create a python file. One way is to do the following in a terminal:
nano hello.py
This opens up a text editor whose instructions for use are on the bottom of the screen. On Windows you could do:
notepad hello.py
In both cases you then write your code. Lets say the content was:
#content of hello.py
print "Hello World!"
Then you need to save the file and execute it with Python.
Which brings us to the Python issue.
Once you have installed Anaconda, and assuming that there are no other Python installations on your computer. The Anaconda Python should be the active Python on system.
Suffice to say that there are other ways of saving files rather than using IDLE. Personally I have found PyCharm to be a much better IDE for writing Python code.
To address the IDLE issue more directly once you type in the terminal/command prompt idle to launch an IDLE session, likely the IDLE Shell will open up. Perhaps you are trying to save this, in which case you will only save the Shell session.
So go to File - New - Save. This should work without any problem (it does on my system). Good luck! Hope this helps.
I am trying to install Ruby and do various things, i have found that terminal takes a hell of a long time to do any tasks and sometimes it doesn't complete anything, aka hangs.
"Mys-MacBook-Air:~ Main$ rbenv install 2.2.0
Downloading ruby-2.2.0.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/7671e394abfb5d262fbcd3b27a71bf78737c7e9347fa21c39e58b0bb9c4840fc
Installing ruby-2.2.0..."
Then this sits for ages without showing me any feedback. It will do this with many things, including node setup and other things i have tried. Sometimes it doesn't do anything and i need to start a whole new terminal with CMD + N, Is it taking a long to download or is it installing without giving feedback? Is it normal for OSX to do this? My internet speed is 10 down so i wouldn't think it is the net.
Also, sometimes when i have finished doing something, like running a server, terminal will not go onto a new line meaning i have to reopen a new window every time, is there a way to restart the command line so i can begin typing commands again?
First off, compiling Ruby can take a while, especially on slower machines. On my new Macbook (maxed out), 2.1.5 took about 8 minutes to install.
To answer your question however, you can monitor that the machine is doing work using Activity Monitor (under Applications/Utilities) or use terminal tools like top or htop, the latter of which can be installed via homebrew. You could also use screen or tmux to background the job if you don't like the idea of opening a new tab.
I'am using the WAMPServer, and it's located in d:/wamp/. Is there a way to show logging window or console in realtime as I'am crawling on my server web ?
On unix/linux boxes I tend to use the tail command to watch logs as I browse for debugging. Of course, Windows has no equivalent, but there are a few options. The one I settled with was mTAIL. It's a standalone app and not a command line program, but it does exactly what you'd expect:
I was going to suggest using unxtools, a suite of ported GNU tools that can be used on the command line, but it's out of date and trying it on more recent versions of Windows I had problems. You can download them from sourceforge if you want to take a look. Also tail for Windows, is another Windows app that unfortunately doesn't seem to work on later versions, but included here in case it saves anyone the time looking.
Of course, you may find that if you prefer the command line you want to look at getting cygwin installed, which contains a host of commands you could use for the task you have.