Pyinstaller - the exec outfile works just as expected. But the app output fails (but only on 1 item) without an error - pyinstaller

This program is a feature rich GUI (thanks to PySimpleGUI) that formats and displays info. Nothing too sophisticated. Its on a Mac M1 - Big Sur. My compile script below is pretty basic too. One screen of my program has a handful of buttonmenus, and for one item on one button, the app produced by pyinstaller exits the program. But the consul just says "process completed, exit code 0." (means "no error")? And that same item works fine - produces the expected output - if I run the corresponding exec file that pyinstaller produced. (And of course, that item works fine when I run it from within my IDE (PyCharm). So....not to sure where to look. Ideas?
import PyInstaller.__main__
PyInstaller.__main__.run([
'main.py',
'--onefile',
'--clean',
'-y',
'--windowed',
'--icon="zaad.icns"'

Related

%debug magic command not working in the Q# Jupyter Notebook environment

As per the documentation provided by Microsoft Azure Quantum at this link , I followed the steps given and installed Q# with Jupyter Notebook, using Anaconda.
I then wrote the following Q# program in a Jupyter Notebook (IQ# kernel) using the code taken from here.
(I am currently using Google Chrome)
open Microsoft.Quantum.Diagnostics;
operation MultiQubitDumpMachineDemo() : Unit {
use qubit = Qubit();
H(qubit);
DumpMachine();
Reset(qubit);
}
When I used the magic commands such as %simulate and %trace, the program executed normally. The DumpMachine result clearly shows the qubit in a superposition of |0> and |1> (measurement probability is 50%), and the trace command printed out the quantum circuit.
%simulate Result
%trace Result
However, when I run the %debug command, the interactive HTML display does not work. The debug control button can display the circuit but, the controls for the chart options do not display the amplitudes, probabilities, or real/imaginary co-efficients.
When I opened the console, I observed the following error, every time I clicked the chart options controls:
Couldn't process kernel message TypeError: state.getDenseAmplitudes is not a function
at fitChart (bundle.js?v=20221015232727:292:32)
at Object.updateChart (bundle.js?v=20221015232727:277:9)
at update (bundle.js?v=20221015232727:811:32)
at bundle.js?v=20221015232727:850:17
at Kernel._handle_iopub_message (main.min.js?v=a4e125c812cb3975203ae429a5b40d180b59b8e4602fcc78390ef4f0dd4d14ac3559189f65f23cd50fd971f98f5842b7746f4182babd20b7ca84e52314bcd4ac:63064:20)
at Kernel._finish_ws_message (main.min.js?v=a4e125c812cb3975203ae429a5b40d180b59b8e4602fcc78390ef4f0dd4d14ac3559189f65f23cd50fd971f98f5842b7746f4182babd20b7ca84e52314bcd4ac:62843:29)
at main.min.js?v=a4e125c812cb3975203ae429a5b40d180b59b8e4602fcc78390ef4f0dd4d14ac3559189f65f23cd50fd971f98f5842b7746f4182babd20b7ca84e52314bcd4ac:62834:44
Error Message
Unfortunately, I am not familiar with this type of error or its possible solutions, so I didn't try anything more than updating the 'iqsharp' package.
Can anyone explain why I'm getting this error, and, if possible, provide with me a solution for the same?
Thanks in advance!

How to run Python, R, Octave or Julia using BowPad?

I try using a very light-weighted editor BowPad to edit and run codes.
Take running R as an example, which has been added to Windows PATH Environment Variable D:\R\R-3.6.2\bin\x64
I try to take some following steps:
I built a test.r writing some testing line codes as 1+2; plot(1:10)
Menu --> Run --> Configure custom commands
Command Name: run R
Command Line: D:\R\R-3.6.2\bin\R.exe $(SEL_TEXT)
$(LINE) The line where the cursor is
$(POS) the position where the cursor is
$(TAB_PATH) the path to the file of the active tab
$(TAB_NAME) the file name without extension of the current tab
$(TAB_EXT) the file extension of the current tab
$(TAB_DIR) the directory of the file of the active tab
$(SEL_TEXT) the selected text or the word at the cursor position
$(SEL_TEXT_ESCAPED) like $(SEL_TEXT) but escaped, useful for urls
When I press to choose run R to run the code, something wrong happens!
It will open a Rterm(64-bit) window each time when I run R!
it shows RGUMENT '1+2' __ignored__ or ARGUMENT 'plot(1:10)' __ignored__
Did I missing something ? BTW, can we set some shortcuts keys for running Python, R, Octave or Julia?
Also, when I reach the homepage of BowPad for more information, little usage of this software can be found!
R.exe refers to Rterm. You can use Rgui.exe instead but that won't automatically process arguments. I think what you likely want is to send the selected text to a running R session rather than starting up a new R session each time.
To do that
download this file and optionally place it on your path https://raw.githubusercontent.com/ggrothendieck/batchfiles/master/clip2r.js
in the Bowpad Run | Configure window configure a Run R command as the following (or if clip2r.js is not on your path use the entire pathname). It should be just like this with no arguments.
clip2r.js
From the Windows cmd line if Rgui is running we see that tasklist | findstr Rgui finds Rgui as the R gui process and you can create additional js scripts by editing clip2r.js replacing Rgui in the js script with whatever is the appropriate word to locate python, julia, octave or other R front end assuming again that they are running.
Now to invoke it from within Bowpad:
ensure that your Rgui session is already running and
from within Bowpad select the code you want to run and copy it to the clipboard and then invoke Run R. For example, to run everything use ctrl A ctrl C ctrl R 0 assuming that Run R is in position 0 in the configure menu. Alternately use the mouse with the Ribbon.
Regarding the comment about difficulty finding help, it looks like Bowpad is based on Scintilla so the documentation for it and the related SciTE editor likely apply to Bowpad too. You can also check the Bowpad source code on github.

Use VBA to send a command to RStudio's Console

I want to do these steps in a macro:
Open Rstudio if it's not open yet.
Activate Rstudio
Put a command into the Rstudio's console.
Hit enter, telling Rstudio to run the given command.
I can do (1) and I can theoretically do (3) with Sendkeys if I can do (2), but (2) isn't working.
These two lines are the basic idea but using notepad instead:
PID = Shell("C:\Windows\system32\notepad.exe", vbNormalFocus)
SendKeys "source('C:/Users/Athena/Documents/helloworld.r')", True
Here a step (2) isn't even necessary since VBA sends the string in sendkeys directly into notepad like how I want. But if I try the same code with RStudio, the string gets pasted into the VBA code instead (or into the excel book if I used a button to activate the macro).
So in my mind, I want to force VBA to put focus on RStudio, then sendkeys will work as intended, and then I can do (4) somehow, telling RStudio to run the code I sent it.

Output/the next command prompt overwrites long command in R

I'm seeing a very strange issue with R (v 3.3.2, running on the command line of a CentOS 7 linux box). If I execute a command that goes over one line in the terminal, the output appears at the beginning of the second line of the command. This didn't happen with previous versions of R, though it does happen with later versions I've installed. I am using Putty as the terminal, but it also happens if I use xterm.
To describe it better, it looks like this:
> tmpvaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaal=1 [before hitting enter]
> tmpvaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
> aaaaaaaaaaaaaaaal=1 [after enter, typing overwrites the a's now]
If the multiline command outputs something, that output occurs on the second line and overwrites the a's. If there is an error, then the error message terminates properly and the next prompt follows the error message. So does anyone have any ideas? Thanks in advance!
Update: After some more experimenting, I've found another odd behavior. If I use CTRL-R to search for a previous multiline command, and then execute it, the output or subsequent prompt appears at the same location in the command as where the cursor was. Here's another example:
(reverse-i-search)`1':tmpvaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal=1[cursor on one before hitting enter]
[hit enter and then:]
>tmpvaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaal=1
aaaaaaaaal=>
Pretty strange. Hard to describe so its hard to find any evidence of other problems like this on stack-exchange or elsewhere. My feeling is it has to do with the readline library but it is strange because this doesn't happen in the shell command line, only in R as far as I can tell.
Update 2: I've found a potentially more revealing way to replicate this issue. If you manually add a bunch of newlines (by jamming CTRL-V CTRL-J repeatedly), then hit enter, the next prompt jumps right back up to underneath the last one. This is not what happens in the underlying shell (bash for me), or in previous versions of R that I can check.
Just to have the answer out there in case anyone else has this issue, the problem was that my system was using an old version of the readline library, 6.2, and the issue disappeared when updating it to the current version, 7.0. So it would seem that even though later versions of R will install with the outdated readline, they don't exactly work correctly.

Jupyter notebook "Run All" prevents BokehJS from being successfully loaded

If I try to "Run All" cells in a Jupyter notebook, with output_notebook() in the first cell and an attempt to show a figure in a cell below, I get the following error message:
/remote/vgrnd5/davidbr/soft/miniconda3/lib/python3.5/site-packages/bokeh/io.py:350:
UserWarning:
BokehJS does not appear to have successfully loaded. If loading
BokehJS from CDN, this may be due to a slow or bad network connection.
Possible fixes:
ALWAYS run output_notebook() in a cell BY ITSELF, AT THE TOP, with no other code
re-rerun output_notebook() to attempt to load from CDN again, or
use INLINE resources instead, as so:
from bokeh.resources import INLINE
output_notebook(resources=INLINE)
warnings.warn(_NB_LOAD_WARNING)
BokehJS has been successfully loaded though (from what I see in the output of the first cell), but it looks like it has not been registered somehow, because if I run the first cell and then "Run All Bellow", then it works fine. None of the tricks of the error message work.
UPDATE: this issue has been resolved and the fix will be in 0.12.2
Evidently the behavior of the Notebook when "run all" is used is to queue up all the cell executions first, before the async outputs happen. The causes the warning to trigger spuriously. None of the core devs use "run all" with any regularity, and this specific queuing behavior was unknown. You can follow this issue for updates:
https://github.com/bokeh/bokeh/issues/4987
In particular, as an immediate workaround, there is this :

Resources