Is it possible to run a python script when another computer connects to the website? - python-3.x

Im trying to set up a prank for my coder friends(have to clarify its not something bad, its just a harmless joke) and they are much more experienced than me. They like to brag about it, so I wanted to make them look like they got hacked by getting a singular file from their computer. Is it possible to run a script to take a their file from their computer as soon as they click on a link that i can share on discord?
I got python script to get a file, but its only when you download the script and use it, it also requires you to have any python version 3+ to run the code. Tried to make a short link but couldnt get it work either.

Related

I want to be able to run my Python through Atom like i have been able to do on my phone with dcoder

So Im very new to programming and computers in general... Over the last couple months i have learned everything i know on my phone using Dcoder with android. I have been searching for a program that is similar but on a laptop that can compile my .py files. So i downloaded Atom and have installed atom-python-run and other packages to run my code through the terminal (even though I would rather it compile like on Dcoder) but it says that python is not a file... so i changed the path in the control panel to the right folder but now it says no pyvenv.cfg file... in cmd it doesnt work when i type in python but it works when i type in py... idk
honestly if anyone knows how i can get a program like dcoder on my laptop i would greatly appreciate it... i am way more familiar with phones than i am with laptops... but im trying to learn.
I have tried everything. This is my last hope before giving up
error message one on atom: windows cannot find python make sure you have spelled it right
is there anyway to just get it to search for py????
If you want to run python using the Atom editor you must first load python into Atom. This is simple. Go to this site and install the extension 'laungage python'. Then search for and install the package 'Script'. Script will successfully run your python files. Run Atom and enter your python file. Then go to the packages menu and click on Script. I haven't been able to get Python Runner or Code runner to run my python files, only Script.
Dcoder has a web app also at https://code.dcoder.tech, Dcoder uses cloud storage, makes it easier to switch between phone and laptop to code when needed.

Python - Can't reproduce console output in a file form

I'm very new to Python, with no previous experience in programming, so if my questions seem stupid, that's because they are.
I was trying to lean a bit more about the "requests" library, so I installed it and followed the instructions in this page (http://docs.python-requests.org/en/master/user/quickstart/). When I got to "Response Content", I tried to emulate the code by copying and pasting it, creating a file named pedidos.py, and running it on my terminal. But when I run it, nothing happens.
This is the code as I copied it:
import requests
r = requests.get('https://api.github.com/events')
r.text
The strangest thing is, if I open a python console in my terminal and input this code line by line, I get a output, which doesn't happen if run it through the file.
I'm fairly certain that the answer to my question is, probably, very simple, and that I will be ashamed to have asked it once someone explains it to me. But the truth is that I'm stuck and really need some help.
Thanks in advance to anyone who takes the time to answer.

Do I need multiple run configurations - one per Python file - in Pycharm even though the only difference between them is the script?

I created a Python project in Pycharm which contains multiple Python files. As of just now, I need to create a run configuration for each Python file in my project, even though they're all the exact same - with the exception of the script.
This seems unnecessary and laborious and I would love to just use one run configuration for multiple Python files.
That said, I'm a novice Python programmer just getting started and so still unfamiliar with large parts of the language.
My Project Files:
My Run Configuration - Used for all Python files:
Some Research Carried Out
I've searched for a solution and explanation to this, but have been unable to find anything. Some of the places I've tried:
JetBrainsTV on youtube (https://www.youtube.com/watch?v=JLfd9LOdu_U)
JetBrains Website (https://www.jetbrains.com/help/pycharm/run-debug-configuration-python.html)
Stack Overflow
I hope there is sufficient detail here, if not I'd be happy to elaborate.
If those files are independent and you have nothing specific to them, then I see two simple ways of running them:
You don't have to manually create a run configuration for every file. You can just Right-Click on the file in the project tree and click "Run "
You can use the Terminal and run them files using the python interpreter as needed.
I was facing a similar situation when I started competitive programming. In my case I wanted to redirect my Test Cases from an input.txt file rather than manually typing the test cases for every run of my code. Using the above solution was not feasible, as I would need to manually change the Script Path and Redirect Input path in the Run Configuration window for every script I was running.
So what I wanted was, one run configuration, that would run all the scripts with Redirect Input path being set to input.txt.
To do that,
I created a main.py file with the following content:
import sys
if __name__ == '__main__':
fname = sys.argv[1]
exec(open(fname).read())
This main.py file is going to run my other python scripts.
Created this run configuration for the main.py file.
Now, every time I needed to run any code, with the code window open, ran this configuration, which actually executed main.py with current file name passed as its argument, which would then also take the inputs redirected from input.txt.
Hope this helps you or anyone trying to run multiple python scripts with a single run configuration in PyCharm.

How do I bring up the page where I write Python program, compile and run it, and see the output?

Sorry if my questions are extremely stupid, but I'm quite at a loss while trying to use Python from Ubuntu Linux. My friend installed the Pycharm for me. I can go without using any commands, to files-->Pycharm projects---> click on one project and see the files, which I can open.
But I'm lost as of how to compile and run the files and see the output at this step? The .py files saved before (written with hello world and some really simple ones) are opening, but how can I see the output?
Also, when I go to the programs by files-->Pycharm projects---> file1.py, file 2.py...etc., do we code and run them from the terminal, using the Linux features? If not, how can I do all of the coding and running from the terminal?
Many thanks!!!
I'm not sure what you mean but "how can I do all of the coding and running from the terminal?" you can use nano to edit to code and run the code on the terminal too
see this link to know more about nano : HERE

Excel can't establish with xlwings connection when running from standalone Python app from Excel

I am trying to create standalone app from a script with xlwings. I used both py2exe and cx_freeze. Both work just fine outside Excel (I added some tests). When I import either of them as a VBA macros in Excel, they also work fine. But so far, on my computer only. I asked my friend to check if the script works on her computer and she got the following error:
So I thought it make sense to figure out whether I do something wrong. I sent her a Fibonacci example and it raised sort of the same error:
It should be something wrong with names of the files, but it's not like obvious for me what exactly. Maybe somebody already knows how to deal with it? Thanks!
If files are downloaded from the internet, they only work right away in the first instance of Excel. Meaning: Your friend should try to close Excel completely. Also check in the Task Manager if there is still an EXCEL process running and if so, kill it. Then try again in a fresh instance of Excel.
update:
Ah I see - the problem seems to be a bug happening when there are unicode characters involved in the file path! I've opened a issue here. In the meantime, try to run the file on a path without unicode characters.

Resources