How to determine if code for an IPython custom magic is executing on startup - ipython

I have a .py file, defining a custom magic, in the /.ipython/profile_default/startup directory, but the intended magic is not being installed. Is there a way to determine where the fault lies? Where is execution failing? Other, very simple .py files in that directory are executing fine.

The short answer appears to be 'no,' there is no way to see what is happening during ipython startup...no log file keeping track of what is happening.
But I did solve my problem.
Opened a jupyter notebook. With the %load magic, copied the code for the custom magic into a cell. Copied the code into a code cell and ran it. Found I needed to install pySerial, and did so. Voila, custom magic now available. (Still have to find out if it works as intended.)

Related

Why is a folder named ".dist" automatically created in VS Code?

Everytime I open a folder or create a workspace, VS Code automatically generates a ".dist" folder and it has been bugging me for quite a long time now and I still do not understand why it even exits in the first place.
It does not seem like there is any problem in deleting the folder.
For me, it is just some bloat that automatically generates when said conditions are met.
I would really like to find if there is a setting which I can toggle ON that disables the auto-generation of the ".dist" folder.
This is due to an extension you have installed which makes it to help with compliling or running. Sass/Less/Typescript/Jade/Pug Compile Hero Plugin is probably the extension that does this.

VSCode Debugging with Mocha and ESM Breaking in ESM "compiled" File Instead of Original

I've been using the ESM module with VSCode and my Mocha unit tests for a long time now, a couple of years at least. Recently when I launch an individual test file in VSCode and set a breakpoint in the test file, it no longer breaks in the original file, but rather breaks in the "ESM compiled" file. I don't really know how ESM works enough to talk about it very well, but the file is compiled/transpiled/transformed in some way with all the imports converted to non-ESModule code. I'm able to step through, and it continues to step through other files as well, but each new file opened is this newly "ESM compiled" version instead of the original file, like it used to be. I only just noticed this recently. So I decided to install and older version of VSCode and see if it still happened, and it turns out it doesn't. With version 1.45.x it works as usual, but with anything newer, I get all these "ESM compiled" files opening up when I step through code.
Does anyone know why this is happening? Is there any new setting I can set in the newer VSCode versions that would cause this to not happen? It's really more of an annoyance than anything. I can still get my work done, but it's not as streamlined as it used to be. I will probably end up just downgrading permanently until I can find a way to make it not occur in the new version.
So, if anyone has experienced this, or knows of something new in VSCode that would cause this, I'd really appreciate some help. Thanks.

Error on a .exe that was running perfectly before being compiled

guys,
I just finished a particular code in MATLAB R2014a that reads and write into multiple text files and saves an image inside the same folder of the script. The script runs perfectly, but the compilation executable does not, so I believe that it has something to do with the PATH that the executable is trying to use to run, I don't really know.
The error was the folllowing:
That's the second read function in the code that tries to read a file and it's possible to see that the code was already successful doing a read/write operation, since a .txt is created.
Just to keep it simple, I didn't use any global paths to the files and tried to keep them inside of the script and executable folder.
I don't have a lot of experience compiling stuff, so I just used deploytool and hit run to test it, so I would love to hear some insights about the possible cause of the problem.
Thank you in advance for the help!
MATLAB doesn't include every file on your PATH when it compiles. It tries to detect additional files that may be accessed when running the code in your application's main file, and include those in the compilation, but it isn't always 100% successful (I'm not sure exactly what conditions it's unable to detect).
After you have run the deploytool once, the full list of files it has detected in this way will be listed under Files required for your application to run. You can add files to this list (whether or not your project has already been compiled) using the "+" icon in the corner of that section.

Groovy debugger out of sync

I am having a difficulty while attempting to debug some code in grails. It is difficult to put into text, so I have posted a screencast showing exactly what the problem is here. In short, while I am debugging the debugger starts jumping from place to place and not following the program logic I have in place. The only other similar question I have found is a year old, had no solution, and can be found here.
The best guess I have so far is that the debugger is displaying the text I have typed in, but is actually executing an older version of the class file which it has cached somewhere. Therefore, I tried:
cleaning the project
manually deleting all of the class files from the target folder and from the target-eclipse folder
Searching my entire hdd for additional files with similar names
removing my project from the workspace and re-adding it
closing and reopening the IDE
grails refresh-dependencies
Importing the project into a new IDE (I was using GGTS, I switched to IntelliJ)
None of those solutions had any effect. I realized that the issue was in a .groovy file, and I was writing almost pure Java, so I deleted the .groovy file, and re-created the class in a .java file. That solved my problem. Unfortunately I am having the problem again, and this time it is in a controller that heavily relies on the grails framework, so that solution is not an option. Other than also being in a .groovy file, another similarity is that the code breaks on an if statement.
My next steps:
Verify that the application is not executing the code I see by using print functions to monitor actual execution flow.
comment out the entire function and re-add functionality one line at a time to see if I can see what breaks it.
Delete the .groovy file, and re-create it as another .groovy file.
Any help is appreciated, and since I can't find any answers online I will continue to update this question as I learn more.
See my comment on the jira issue that you raised. You have found a problem with the groovy compiler and how it calculates line numbers. This is not a problem with executing the wrong class files or using a broken debugger. The debugger is doing exactly what it is expected to do. It is the compiler that is providing erroneous line number information.
The next step, as described in the issue, is to provide a simple project that recreates the bug. I tried to do so myself, but could not. So, please supply something that we can work with. Then we can notify the groovy compiler team.

Talend studio tWaitForFile issue

I am using a tWaitForFile component from a Talend Studio Project and I want to know if there is a way to be sure a file to trig the event when this file is fully written on disk.
I tried to set the advanced property : "Wait the file to be released"
but it seems this is useless, the file trigs the component even it is not finished to be transmitted.
Does anybody have the same behaviour and a solution to fix that?
The version of Tos is: 4.2.3
The advanced setting "Wait for file to be released" only works on Windows. It has no effect on Unix, which probably explains why it did not work for you.
It is generally difficult, or even impossible, for a Unix process to figure out if a file has been written completely or not. Consequently, there is no easy way to do this in Talend, either.
(For example, if you wanted to wait until the file size does not change anymore -- how long do you wait?)
A common solution involves the process writing to the file: Create the file under a different name first, and when it is written completely, rename it to the name that the other process expects. That way, it will show up in its full size immediately.