PlatformIO CLion integration failed "Cannot run programm" - clion

Iam failing while integrating pio to the CLion IDE. I included the PATH variable to the ~/.profile file (three different ways) as:
export PATH=$PATH:~/.platformio/penv/bin
export PATH=$PATH:home/jonas/.platformio/penv/bin
export PATH="~/.platformio/penv/bin":$PATH
and can run the pio – version (and also the equivalent platformio) without sudo privelegies.
But when I’m trying to create a new pio project in CLion I always get
```Cannot run programm ./home/jonas/.platformio/penv/bin” (in directory “/tmp”): error=13, Permission denied``

Ok, I got it working. The problem was that the path to pio was not complete. The path (/home/jonas/.platformio/penv/bin/home/jonas/.platformio/penv/bin) points to the folder but not to the file to run. The full path is:
/home/jonas/.platformio/penv/bin/pio (or platformio).
However, in the create project window, you don’t even get to correct the path and it was automatically created during installation. This is a bit confusing.

Related

How to run file watcher in virtual environment in GoLand?

I have enabled golangci-lint file watcher in GoLand but when I save file I got error like below one:
msg="Running error: context loading failed: no go files to analyze"
After some debugging I found that this error comes when I run golangci-lint without activating my virtual env.
So my question is how do I tell file watcher to run golangci-lint after activating virtual environment?
So, In summary I want this:
Before running any file watcher command, Run this command
source .my_virtual_env_folder/bin/activate
This command is basically activates virtual environment.
I am new to GoLand. I tried to do google search but no luck.
I found a workaround.
Make a executable file, write all the commands there. We have full control on which commands do we want to run and in which order. Then in file watcher "Program", paste the absolute path of this file.
I just wrote source <name_of_the_env>/bin/activate at the top of file and then wrote my main command.
This way it activated the virtual environment and then call the command.

CLI Go Config.toml file location

I am attempting to test a Golang application hauser locally on via -bash CLI before deploying on a VM.
Per the documentation, I compiled locally and copied the example-config.toml file. I then mapped to the GOPATH and opened hauser.exe to open config.toml file. However, when I execute, it returns open config.toml: no such file or directory
C02Z30ANLVDV:~ pmcgin2$ $GOPATH/bin/hauser -c Documents/go/bin/config.toml
2020/08/14 18:05:23 Cannot find folder , make sure it exists
C02Z30ANLVDV:~ pmcgin2$ open Documents/go/bin/config.toml
No application knows how to open /Users/pmcgin2/Documents/go/bin/config.toml.
Is there an alternative command I can execute to override the default config.toml location for an application like this?
There are two possibilities to solve your issue:
give an absolute path as argument:
$GOPATH/bin/hauser -c /Users/pmcgin2/Documents/go/bin/config.toml
give a relative path from the binary location:
$GOPATH/bin/hauser -c config.toml
Generally, it is easier to use absolute paths.

Access denied executing compiled program

Using Windows, my Hello World code is in src\hello\hello.go.
When using the command "go run hello.go"
Getting Error like this
# command-line-arguments
C:\go\pkg\tool\windows_amd64\link.exe: cannot create $WORK\b001\exe\a.out.exe: open $WORK\b001\exe\a.out.exe: Access is denied.
This can be caused by an anti-virus application like AVG or G-Data.
You can use the -o argument with go run to specify the output directory, and add that path to the exclude list of your anti-virus should this be the cause.
This usually happens when the executable is being edited in some way, or currently running. Check if you have any spare processes of this executable, or in the worst case, try restarting your computer.
Alternatively, it may also be that the linker genuinely does not have write access to the output directory. Make sure that the directory is writable to the user you are compiling your program as.
Adding code folder to the exception list solved the problem.
Windows Security-> Virus and Threat Protection Settings -> Exclutions->Add folder
Add your workplace folder here where your code exists. Adding temp folder didn't work for me.
go build gotest.go ; .\gotest.exe
Using the above command (regular command prompt.) can eliminate pop-up alerts but don't know the reason.

Angular Console: Can't create library

I'm trying to create a new library using v 8.1.0 of the Angular Console on Windows. The error I get is "ENOENT: no such file or directory, mkdir "c:\path\to\my\workspace\libs\new_library_name"
"c:\path\to\my\workspace\libs" exists already
new_library_name folder should be created by Angular Console
The command run by the console is ng generate #nrwl/angular:library new_library_name.
I've tried different names/paths, running as administrator, running inside VSCode and in the standalone console. No luck with anything. This used to work.
Also, if I create the folder c:\path\to\my\workspace\libs\new_library_name and then run the console again, I get an error ENOENT: no such file or directory c:\path\to\my\workspace\libs\new_library_name\ReadMe.md. Of course the ReadMe doesn't exist - it needs to be created by the console.
What am I doing wrong or where to look?
Problem solved. I had turned on Controlled Folder Access in Windows 10 and mistakenly included my project folder as a controlled folder, which prevented applications (Angular Console, Yarn, etc) from writing to the folder. Removed it from Controlled Access and all is working again.

Ros Environment in root

I have a ros (kinetic) environment set up on a raspberry pi 3 and am trying to get ros to execute upon startup via a simple bash script which calls roslaunch. Ros works in the user domain but fails when called from root.
Here is my launch_ros.sh script:
#!/bin/bash
source /home/pi/ros_catkin_ws/devel/setup.bash
export PYTHONPATH=/opt/ros/kinetic/lib/python2.7/dist-packages
roslaunch my_pkg pkg_launch.launch
When I run sudo /home/pi/Desktop/ros_launch.sh the roscore crashes with
ERROR: cannot launch node of type [rosout/rosout]: can't locate node
[rosout] in package [rosout] failed to start core service [/rosout]
The traceback for the exception was written to the log file
But, if I comment out
source /home/pi/ros_catkin_ws/devel/setup.bash
and execute /home/pi/Desktop/ros_launch.sh, ros works fine.
Also worthy of noting is if I leave the above source line uncommented when running in the user domain I get the same error as I do in the root. I think this might be pointing me to the solution but I am still very new to ros.
Has anyone come across this issue and found a solution?
In order to run a node as root after changing your shell to root using commands like sudo -i, You can source your current bash profile thats located inside your normal user .bashrc and use it inside root shell.
Try the following code:
#!/bin/bash
source /opt/ros/kinetic/setup.bash
source /home/pi/ros_catkin_ws/devel/setup.bash
export PYTHONPATH=/opt/ros/kinetic/lib/python2.7/dist-packages
roslaunch my_pkg pkg_launch.launch
You need to source your workspace devel to be able to find your own package.
But, you need to source ROS devel to be able to use roscd, roslaunch, ...
In the code below I added:
source /opt/ros/kinetic/setup.bash
to source ROS and be able to use it.
PS: If it's still not working you should try a short delay before running roslaunch.
I was accidentally in a conda environment (base only) and it was messing up big-time. Try disabling any Python virtual environments.
It really worked and it inspired me to report that I didn't have rosnode as a program when I was planning to call ROS scripts in my own applications. Calling source .bashrc directly from the Raspberry Pi's system would refresh the terminal, but there was no way for my program to take over. The solution was to place the required ROS environment scripts in a separate script like name init_env.sh and then call source init_env.sh before any other ROS scripts were executed.

Resources