Re: Python script accessing own source code

2021-05-13 Thread Chris Angelico
On Thu, May 13, 2021 at 5:27 PM Robin Becker wrote: > > On 12/05/2021 20:17, Mirko via Python-list wrote: > > Am 12.05.2021 um 20:41 schrieb Robin Becker: > >> ... > >>> > >... > >> since GvR has been shown to have time traveling abilities such a > >> script could paradoxically appear

Re: Python script accessing own source code

2021-05-13 Thread Robin Becker
On 12/05/2021 20:17, Mirko via Python-list wrote: Am 12.05.2021 um 20:41 schrieb Robin Becker: ... ... since GvR has been shown to have time traveling abilities such a script could paradoxically appear acausally. -- yrs-not-too-seriously Robin Becker Not sure, if that's what y

Re: Python script accessing own source code

2021-05-12 Thread Mirko via Python-list
Am 12.05.2021 um 20:41 schrieb Robin Becker: > ... >> >> with open(__file__) as myself: >> print(myself.read(), end='') > > very nice, but accessing code that's already seems quite easy. I > think the real problem is to get a python script name that creates > and writes itself. So I would

Re: Python script accessing own source code

2021-05-12 Thread Robin Becker
... with open(__file__) as myself:     print(myself.read(), end='') very nice, but accessing code that's already seems quite easy. I think the real problem is to get a python script name that creates and writes itself. So I would ask if any one has the solution to the self writing script

Re: Python script accessing own source code

2021-05-12 Thread Stestagg
On 2021-05-12 15:48, Michael F. Stemper wrote: > > On 12/05/2021 08.26, Dino wrote: > > > >> Hi, here's my (probably unusual) problem. Can a Python (3.7+) script > >> access its own source code? > > > > Here is a fairly simple python program that reads itself: > > > > =

Re: Python script accessing own source code

2021-05-12 Thread MRAB
On 2021-05-12 15:48, Michael F. Stemper wrote: On 12/05/2021 08.26, Dino wrote: Hi, here's my (probably unusual) problem. Can a Python (3.7+) script access its own source code? Here is a fairly simple python program that reads itself: #!/usr/b

Re: Python script accessing own source code

2021-05-12 Thread Michael F. Stemper
On 12/05/2021 08.26, Dino wrote: Hi, here's my (probably unusual) problem. Can a Python (3.7+) script access its own source code? Here is a fairly simple python program that reads itself: #!/usr/bin/python import sys with open( sys.argv[0], "