Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

Python API: VSCodium creating temp files

#1
Hello,

I first used RoboDK in 2018 and have been using it varying amount through the years. At some point you added the VSCodium as optional IDE and since we have been mainly using Python API, it was pleasant upgrade.

However, I have been having an issue quite some regarding it and recently when I started to RoboDK more, it has driven me a bit crazy.So the problem is: Everytime I open Python script in RoboDK to edit it, it open VSCodium and creates a COPY of the script in "User / AppData / Local / Temp" folder regardless where the original file was stored.I have been trying to find the reason or solution for this quite some time. First time it happened, I really though I had lost all the progress I had done day before. Only solution so far has been: open VSCodium, open the script in original folder, replace the script in RoboDK and then keep modifying it. But everytime RoboDK is closed, it needs to be done again.

所以我在做一些根本性错误或世界卫生大会t are the settings that cause this behavior? I tried asking about this from RoboDK support (last year) without ever getting a reply.. Hopefully someone has a clue what is the cause for this. Any additional info you might need, I can try to provide.

Thanks for the help.
#2
I know this is painful, I had to learn it the hard way too.
I don't think we can do much about it, unfortunately.
Personally, to avoid that problem, I almost never include python script in the RoboDK station.
I will have them in a separate folder and run them directly from VSCodium during the development process.

One thing you can do is to delete the file in your temp folder once you closed it in VSCodium. That would solve the problem I think.

If you need to call them from the UI, you have 2 choices.
你可以简单地删除宏RDK every time you do a modification and redrop de new version in.
You can also save your python macro in RDK's local library and activate this option. You can then call the macros even if they are not part of the station.



Jeremy
Find useful information about RoboDK and its features by visiting ourOnline Documentationand by watching tutorials on ourYoutube Channel.


#3
Hello Jeremy,

So it is just inevitable feature and only some workarounds exists. I have been using scripts from UI and doing exactly what you proposed: replacing the script all the time. Had not though about adding them local library though so its good to remember that it also an option.

Regarding keeping VSCodium and RoboDK separate, I tried that too but there were some problems if I remember correctly. At some point at least, VSCodium did not found RoboDK modules if opened VSCodium as its own. I did not investigate it further though so could be simple fix for that.

It sure is a bit painful to use. I just feel like that earlier with Python IDLE this problem did not exist. So it's the cost for using a more proper IDE I guess :)
#4
You should be able to install RoboDK as a separate module using pip like any other module that you install using the Python Package manager:
Code:
pip install robodk

The official package on PyPi is here:
https://pypi.org/project/robodk/

You can also use the sample BAT file to install this library here:
C:/RoboDK/Python-robodk-Install.bat

I recommend you to install the RoboDK library and keep your project separate from RoboDK if you are doing a lot of programming as your Editor does not live inside RoboDK.

More specifically, if you are using VSCode, you should follow these steps:
  1. Install the official Visual Studio Code and open it from the start menu.
  2. Choose the Python version you want to use from the bottom Right (you may find it on the bottom left depending on the VSCode/VSCodium version).
  3. Place your cursor in the terminal (select View-Terminal if you don't see it)
  4. Type "pip install robodk". This should install RoboDK for the chosen version of Python and it should work outside your RoboDK environment.
  5. Select F5 (or Run-Run) and enter to run your Python script.
See attached image.


At RoboDK we do most of our research and development in this manner because it is easy to keep track of the source code.




Users browsing this thread:
1 Guest(s)