Selenium/splinter taking a browser screenshot not working - linux

I have a script that using splinter to take a screenshot of a certain page.
When I run this script on my home computer (ubuntu) it works perfectly fine (takes the screenshot). When I run it on the terminal (debiuan - sudo python) on my server it also works fine.
However, when I have it run the script on the server it does not seem to be able to save the picture.
Why is this?
I am inclined to say that python does not have write permissions but I run the python script with sudo and I chmod 777 the directory, but it still is not able to save the picture.
Is there any other way I have to give python permissions or is this not a permission issue?
The line where splinter is taking a picture is
browser.driver.save_screenshot('picture.png')

Related

Suddenly unable to run Python scripts w/ WSL2 - Permission Denied

I am really not sure what happened, but over night I am unable to run any of my programs. When I try to run a script in Visual Studio Code, I get the following output: /bin/sh: 1: python: Permission denied
It's very odd, because it seems to have just happened out of the blue. Based on the problem, it seems that my system now no longer is granting me to run a .py file. I have found some adjacent problems that suggest running something like chmod +x my_file.py, but this doesn't result in anything on my end.
I would like to know where one can change this setting so that I can go back to running my python files as I would expect them to.

Trying to run script on boot, but "ModuleNotFoundError"

I've been struggling with this issue for a while, when I run python3 main.py my code runs, however when I try sudo python3 main.py it can't find the module that I've downloaded.
This hasn't been an issue until now, I want to run on boot, I have tried to edit the rc.local file, which needs superuser permission but of course it does not run without permission.
Also, when I install modules using the terminal, it doesn't seem to work at all, until I open thonny and download the modules that way, I can't see what i'm doing wrong.

_tkinter.TclError: couldn't connect to display "127.0.0.1:0.0"

I have written a Python Scraper with Selenium and in that I have to tackle the 2FA,so, I am prompting for the user input to get the code and move forward, everything is working smoothly in local machine and the whole script is executing correctly and providing the desired output.
Now, as I have deployed the Application to Ubuntu Server on Linode machine, the pymsgbox is not opening on the server and I am getting the following error,
couldn't connect to display "127.0.0.1:0.0"
I downloaded the library from the following command,
sudo apt-get install python3-tk
I have tried all the possible solutions whether that is on Stackoverflow, superuser, reddit, ASK etc but not working.
Please let me know if I am missing something.

Can't run external programm from a udev-started script

I'm trying to set up a automatic PDF-Viewer via a Raspberry Pi.
The problem I'm facing is that the script I started from an udev-rule is doing anything I want, except starting any external program. When I'm runnig both scripts from terminal, everything works fine as well, xpdf is launched with no problems.
This is how my scripts look right now:
startpdf (successfully executed from a udev-rule)
!#/bin/bash
/usr/local/script/pdfscript &
exit 0
pdfscript
!#/bin/bash
mkdir -p /media/usb/stick
sudo mount /dev/usbstick /media/usb/stick
/usr/bin/logger Testing the Script
sudo mkdir -p /usr/local/script/testfolder
/usr/bin/xpdf
Everything is working fine, the testfolder is created and the logger is doing fine as well. The reason for having two scripts is the short amount of time before a udev-started script is terminated.
The only problem is that xpdf won't start. I tried it with libreoffice or any other program too and I don't know what am I missing.
Please help me, It's driving me nuts :(

ubuntu backup-manager Permission denied

I've recently installed backup manager onto my ubuntu machine to have automated backup going. The problem is when I go to set up the automatization using this code -
it comes us up saying this "bash: /etc/backup-manager.sh: Permission denied"
I do not understand this error. I've tried change the user who read/writes to someone other than root and that didn't work. I tried changed the chmod number from 770 to 700 and still didn't work.
any info on this is welcome. Thank you to those who help :)
those wondering I am using this tutorial giving to me by the host. https://documentation.online.net/en/dedicated-server/tutorials/backup/configure-backup/start
I'm using the desktop version of ubuntu 16 incase that is needed
The sudo doesn't do what you want in this case. What happens is that the shell evaluates the redirection and attempts to open the /etc/backup-manager.sh for you before the sudo cat even gets started. That fails because the shell still runs as you unprivileged user. You have to say sudo -i to open a new root shell, execute the commands and exit again.
Alternatively you could try sudo nano /etc/backup-manager.sh and paste the contents there. This would work because the editor is run as root and does the file opening itself when you save.

Resources