Connecting to kernel stuck - python

https://i.stack.imgur.com/sCSyD.png
I am not sure why it is stuck on the environment '\' while I try to run a cell in .py file using Jupyter. It has been stuck on this for 10+ minutes? Do I need to change/edit something?

Related

"Failed to execute script" when trying to share exe

So I can compile my project and run the .exe perfectly fine on my PC but if I try to share it with others or run it on another PC I get "Failed to execute script WS.py" I tried installing selenium, selenium-wire, python, and pyinstaller all in an env to fix this so the project would have everything it needed installed already.
Here is the error in CMD
Before this I was getting a pop up instead like this
The pop up
I am a nooby programmer so please explain like I'm five, thanks.
EDIT: I also have the exe in the spot where it is needed to run, I did not leave it in the dist folder. As stated it works on my PC but not on others when shared, I feel I am missing something simple here.

How do I solve "pythoncom39.dll could not be located error"?

It has started appearing ever since I installed Anaconda on my PC. It doesn't affect anything and when I press "Ok" it goes away. But it is quite annoying and I would like to know the reason. It has only appeared when I try to run a development server in Django or try to install python modules using pip. Is there any way to solve this?
It happens because anacondaa3\Library\bin\ in this folder pythondicom39.dll has crashed you need to replace it with a new file
Yes, that dll file might be corrupted. Just replace, and then try it. You can download the pythoncom39.dll files from the following link
https://freeonlinestudies.com/python-dlls/

How to locally automate jupyter lab by dynamically creating cells, setting file paths, and executing?

I'm automating a bunch of tasks locally with python and shell scripts. I've created a python socket server and clients so I can automate the execution of scripts in different shells and envs. It's not fully-functional, but I can fire up shells, run scripts, and have them connect to the server before executing. One app uses jupyter lab and notebooks. I'm not finding much about how to automate this for what I need.
I tried converting my ipynb file to a py file thinking I could treat it as an ordinary python script, then use a watch folder, load the file names in a dict, and just script in some loops with variable file names, but that doesn't seem to be the caseā€”at least I haven't found anything discussing how to do it with notebooks.
This is what I need to accomplish (programmatically):
Open a new shell, activate env and launch jupyter lab (this I can do)
Connect jupyter lab to the socket server (guessing I can do this in a cell?)
Create a cell with a command that loops through each file in a specific folder with args
Execute all cells in the notebook
Send a message back to socket server that things have completed
Whether or not I need to convert the ipynb to a py file or automate jupyter lab doesn't matter to me, as long as I can automate it. Point in the right direction would be appreciated.
Being new to jupyter notebooks, I wasn't understanding properly how they work. I didn't realize there was a flag when converting to completely strip out all the data except for the raw code. --no-prompt
Running this command will completely convert the ipynb file to the raw code py
jupyter nbconvert --to script --no-prompt myfile.ipynb
Once you do that, they are just like any other python script. I was able to easily add in all my code and have the script working as needed now.
That being said, the suggested tools by #krassowski would be fantastic for more complex projects in the future, especially in a case when you don't want to convert the notebooks.

Jupiter notebook stuck

I am trying to open a Jupyter notebook I have done, but since when I uploaded a huge dataframe it is stuck like this:
I don't know what to do actually. I have tried to ctrl+C (force quit) jupyter and restart it again several times. I have an important code there. Is there a way to recover it or open the page? I know it's not very much info. This notebook is stored in an anaconda environment and for the moment I did nothing but trying to open it....it looks like jupyter is very slow down.
EDIT: it looks like it is very memory expensive...
Thank you,
Federico
Jupyter notebooks are actually JSON files, so you can open them with plain text editors. Presumably, your browser is having a hard time rendering the notebook - opening it in a text editor won't render anything at all, so you should be able to read the code.
This will allow you to back up the code of the notebook.

How to Give Python Permission to Write Files

I'm learning Python and don't quite have the vocabulary to describe this. However, I can't seem to save files created in Python to my Window10 computer. I discovered this while seeking a help to try to get a file to save in Pandas. I then discovered the same problem when creating a db using SQLITE3 the script seemed to have fun but no database files appeared.
Does anyone know how to fix this? FYI I've got a dual boot Ubuntu machine, I can save files via Python in Ubuntu but really need it to work on my windows machine too.
I am running python via Jupyter Notebook.
I had to make a couple changes to the code snipped that you linked in order to get this to work.
A difference between windows and linux is the file path deliminator is a forward slash:
df.to_csv("tests/ysi_test_files/filehere.csv", index = False)
If you want a hard absolute path to a file, then do something like:
df.to_csv('C://Folder//myfilename.csv', index=False)
Again, if you copy the folder path from a windows folder you will get the backslashes instead of forward slashes. You will need to change those in your code to save the file:
C:\Users\myuser\Desktop\python\
to
C:/Users/myuser/Desktop/python/
If you are running the python script from command prompt then right click on it and run as administrator should solve the issue.

Categories