Suddenly unable to run Python scripts w/ WSL2 - Permission Denied - python-3.x

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.

Related

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.

Kivy-iOS toolchain wont run 'Permission Denied'

Im trying to convert a kivy app to run on iOS and have followed the information on the kivy site. However, once everything is downloaded the first step is to compile the toolchain process, which I cant do. So the command
./toolchain.py openssl kivy
returns
./toolchain.py: Permission denied
No other messages so a bit difficult to troubleshoot. I found this post. That suggestion hasn't been accepted or marked as correct, but I tried anyway and changing permissions doesn't fix the problem. I have tried
chmod a+x toolchain.py
sudo chmod 755 ./toolchain.py
sudo chmod 755 ./toolchain.py
All of which change the permissions as expected but trying to run toolchain now gives me
from: can't read /var/mail/kivy_ios.toolchain
./toolchain.py: line 4: syntax error: unexpected end of file
So changing permission doesn't seem to work either and I'm now out of ideas???
Also for info I'm running kivy in a venv on Catalina
So - it turns out after updating XCode you have to reselect the command line tools. Then it all works fine.
This answer is for future users. If any of the above answers don't work.
Use this https://pypi.org/project/kivy-ios/ and follow all the instructions

PySpark is not starting from Windows Command Prompt

I am trying to start pyspark from windows cmd. But so far no luck. I am getting an error msg as shown below.
I have gone through almost every corner of stackoverflow and net search but could not able to fix this.
So far I have followed the steps as mentioned below:
set JAVA_HOME, SPARK_HOME and HADOOP_HOME in the System Variables.
Update the PATH variables as shown below.
I have managed all the 'space' related issues. Despite all these, I am still not able to start the spark-shell or pyspark from command prompt.
I am using Windows 10 Home edition.
Am I missing out something?
Note: I have installed Java, Scala and Python and from command prompt they are running fine.
Did you enable access to the default scratch directory for Hive. Make sure the directory C:\tmp\hive exists; if it doesn’t exist, create it.
Next, you need to give to it a permission to access winutils.exe. Navigate back to where you put this .exe file then run the permission command
cd c:\hadoop\bin
winutils.exe chmod -R 777 C:\tmp\hive
Once you have completed this try again to launch PySpark!

Selenium/splinter taking a browser screenshot not working

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')

Issue with running Bash script in linux.

Im having an issue with a bash script i picked up from google code. I have all the dependencies installed and i have it setup to what i think is correct.
To run the code im typing into the console ./jasagerPwn.sh
The error its saying is
[!] FATAL: You must run jasagerPwn from inside the directory...
....WHAT DIRECTORY? I dont know what directory it expects me to run it from?
You can see the script i am using here: http://jasagerpwn.googlecode.com/svn/trunk/jasagerPwn
When you run the script, it looks in the current dir if you have something matching jasagerPwn. If not, the error you was encountering appears.

Resources