top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Python Script Hashplings, python fallback

0 votes
175 views

If I execute a Python3 script with this haspling (#!/usr/bin/python3.3) and Python3.3 is not installed, but Python3.2 is installed, would the script still work? Would it fall back to Python3.2?

posted Jul 25, 2013 by Ahmed Patel

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

The answer is "probably not." If you just want to use the latest version of Python 3 you have installed on your system, use: "#!/usr/bin/python3". When you use the specific minor version numbers, they point to that specific minor version.
Actually, the preferred shebang line is of the form: "#!/usr/bin/env python3". This way the end users can override the interpreter with, say, a virtualenv, rather than being stuck with the system default.

answer Jul 25, 2013 by Salil Agrawal
Similar Questions
0 votes

I am trying to use mitmproxy behind a company proxy that requires a user/password login.

The setup is: Local PC's browser -> mitmproxy (on local PC) -> company proxy -> internet.

Based on this SO thread, this is how you use mitmproxy within a Python program. This example works fine when there's no proxy.

from mitmproxy.options import Options
from mitmproxy.proxy.config import ProxyConfig
from mitmproxy.proxy.server import ProxyServer
from mitmproxy.tools.dump import DumpMaster

class Addon(object):
    def __init__(self):
        pass

    def request(self, flow):
        # examine request here 
        pass

    def response(self, flow):
        # examine response here
        pass


if __name__ == "__main__":

    options = Options(listen_host='0.0.0.0', listen_port=8080, http2=True)
    m = DumpMaster(options, with_termlog=False, with_dumper=False)
    config = ProxyConfig(options)

    m.server = ProxyServer(config)
    m.addons.add(Addon())

    try:
        print('starting mitmproxy')
        m.run()
    except KeyboardInterrupt:
        m.shutdown()

Assuming the company proxy is at IP "1.2.3.4" port 3128 and requires a login USER and PASSWORD, how can I change this script to have mitproxy use that proxy instead of going to the internet directly?

Addition info: I am not using mitmdump with the script-parameter to run this script. The goal is to run this from Python 3.8 with a pip-installed mitmproxy

+1 vote

i want to create a chrome extension. its have complex mathematical queries. so i need to use python as scripting language. help me to implement python script in google chrome addon

+1 vote

I would like to create AWS monthly billing graph using python and python flask.so for this i need python script using that i have to get last 6 month's monthly bill in AWS.

For this, I have created one virtual environment in my local machine. for example my ip is: 127.0.0.0:5000. Here after pull that script, it's automatically connected to AWS and display's last 6 month's data. its my requirement.

0 votes

How can write a python script which will execute some perl scripts in a gui and shouldn't be post processed....?

...