sudo python3 not working to gain root acces - python-3.7

Hi so im trying to run root on a program im doing to run some neopixles and when I try running it it comes up with the error
File "work.py", line 1
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
^
SyntaxError: invalid syntax
I am pretty new to this so I don't really know whats wrong any thoughts why this is happening?
https://learn.adafruit.com/neopixels-on-raspberry-pi/python-usage

Related

Trying to install the mongodb extension (MacOS Big Sur)

When writing this command line
sudo C_INCLUDE_PATH=/usr/local/opt/openssl/include /Applications/XAMPP/xamppfiles/bin/pecl install mongodb
I get this error.
fatal error: 'unicode/usprep.h' file not found
#include <unicode/usprep.h>
^~~~~~~~~~~~~~~~~~
1 error generated.
make: *** [src/libmongoc/src/libmongoc/src/mongoc/mongoc-scram.lo] Error 1
ERROR: `make' failed
It says something with the usprep.h, it took for me days to figure out in many different ways but unfortunately you guys may support me to solve it.

raspistill returning file not found

I am trying to use the 64 bit version of raspbian (which can be found here: https://www.raspberrypi.org/forums/viewtopic.php?f=117&t=275370
I downloaded it, installed everything, ran my updates and then switched on the camera. But when I try to run it, the PI just gives back
bash: /opt/vc/bin/raspistill: No such file or directory
When I do a ls, I can see the directory fine:
pi#raspberrypi:/opt/vc/bin $ ls
containers_check_frame_int containers_test dtoverlay-pre raspiyuv
containers_datagram_receiver containers_test_bits dtparam tvservice
containers_datagram_sender containers_test_uri edidparser vcdbg
containers_dump_pktfile containers_uri_pipe mmal_vc_diag vcgencmd
containers_rtp_decoder dtmerge raspistill vchiq_test
containers_stream_client dtoverlay raspivid vcmailbox
containers_stream_server dtoverlay-post raspividyuv vcsmem
and when I look at the permissions, there are read/execute permissions for everyone:
-rwxr-xr-x 1 root root 142397 Nov 1 16:25 raspistill
Im at a bit of a loss here - the file is right there, so why is it not being found when I try to call it from the command line?
Unfortunately, it looks like MMAL userland still (at the time of writing this) has some unresolved issues with 64bit raspberry pi OS, so it is disabled.
However, one can use docker or cherry-build 32bit packages as workarounds.

linter pylint is not installed vscode

I know there are multiple version of this question on SO, I've tried the solutions posted on those threads and they don't seem to help :(
I have VS Code installed in an Ubuntu VM. I can't seem to get the python linter to work. i.e. I get a message saying
Linter pylint is not installed
I am pretty sure pylint is installed on the VM because when I run which pylint I have a valied output.
Here are the outputs for which python and which pylint respectively
/usr/bin/python
/home/rakshak/.local/bin/pylint
And I have the following in my User settings and workspace settings in VS Code
// Place your settings in this file to overwrite the default settings
{
"python.linting.pylintEnabled": true,
"python.linting.pylintPath": "/home/rakshak/.local/bin/pylint",
"python.pythonPath": "/usr/bin/python"
}
So, turns out this was just a permissions issue!
When I got the pylint not installed message, I was presented with a button to "Install pylint" this runs
sudo pip install pylint
This changed the owner of my .local/lib/ to root and made it inaccessible to vscode.
Output of ls -ld ~/.local/lib/ was
drwx------ 3 root root 4096 Sep 24 10:49 /home/userName/.local/lib/
Runing chown with my group and user fixed this issue.
sudo chown -R group:user ~/.local
now the output of ls -ld ~/.local/lib/ reads
drwx------ 3 userGroup userName 4096 Sep 24 10:49
/home/rakshak/.local/lib/
Have you checked with which python version you have installed pylint?
If you have used python 3.6 then the setting has to be like this:
"python.pythonPath": "/usr/bin/python3.6"

Can't install scala in emacs - An error occurred while loading `/home/nazar_art/.emacs'

I tried to install Scala accord this Set up for learning Scala with Emacs.
My current OS is Ubuntu 12.04.
I did exactly step by step.
After installation I run Emacs and see next error:
Warning (initialization): An error occurred while loading `/home/nazar_art/.emacs':
File error: Cannot open load file, scala-mode-auto
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
I guessed that it is problem with permission. I change it for scala-mode but without success.
Here is content of ~/.emacs.d:
nazar_art#nazar-desktop:~/.emacs.d$ ls -lg
total 12
drwx------ 2 nazar_art 4096 Oct 10 10:58 auto-save-list
drwxrwxr-x 4 nazar_art 4096 Oct 5 00:12 elpa
drwxrwxrwx 4 nazar_art 4096 Oct 10 10:41 scala-mode
I'm newly at emacs and not sure that can find cause of error follow my intuition.
Any suggestion?
How to solve this trouble?
This worked for me:
Install Scala
sudo apt-get install scala
Get scala-mode
cd ~/git
git clone git://github.com/tuxdna/scala-mode.git
Set up the load-path
(add-to-list 'load-path "~/git/scala-mode")
Require scala-mode-auto
(require 'scala-mode-auto)
Created my first Scala source ~/first.scala. The mode was loaded.
object First {
def main(args: Array[String]) {
println("Test")
}
}
M-x scala-run-scala
Loaded the source with C-c C-l.
Entered First.main(null) in the interpreter. The program ran.

Why do I get compilation errors when trying to connect to postgresql with c?

I tried to create a simple c programm which should connect to my postgres db, but I am not able to get aware of the following compilation errors...
I am using Ubuntu (but also tried to compile on Fedora already - with the same errors...)
uname --all
Linux alp2nwmon001 2.6.35-25-server #44-Ubuntu SMP Fri Jan 21 19:09:14 UTC 2011 x86_64 GNU/Linux
I installed postgres inclusive libpq-dev libpq5 libs already and I have no clue why this simple code is not working...
#include "/usr/include/postgresql/libpq-fe.h"
int main () {
PGConn *test;
return 0;
}
I also tried lots of variations like: #include <libpq-fe.h>, and specify the path to the .h file when calling gcc.
But always the same errors...
gcc -c -I/usr/include/postgresql/ -L/usr/lib/ -lpq pqtest.c -o postgres
pqtest.c: In function main:
pqtest.c:4: error: PGConn undeclared (first use in this function)
pqtest.c:4: error: (Each undeclared identifier is reported only once
pqtest.c:4: error: for each function it appears in.)
pqtest.c:4: error: test undeclared (first use in this function)
Further I found a lot of howtos, but still the same result:
http://www.mkyong.com/database/how-to-building-postgresql-libpq-programs/
http://forum.ubuntu-fr.org/viewtopic.php?pid=3212499
I also checked the API description at the postgres webpage, still no luck.
In my opinion all files exist where the should exist...
ls -lah /usr/include/postgresql/libpq-fe.h
-rw-r--r-- 1 root root 20K 2011-04-20 16:36 /usr/include/postgresql/libpq-fe.h
And the libraries...
ls /usr/lib/ | grep pq
libpq.a
libpq.so
libpq.so.5
libpq.so.5.2
libpqxx-2.6.9.so
libpqxx.la
libpqxx.so
I hope somebody can help me here...
Thx br,
roegi
Use PGconn instead of PGConn.