Python Forum
Accessing same python script from multiple computers
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Accessing same python script from multiple computers
#1
I currently work in a facility that uses a very large ZFS using the NFS protocol. We have many servers that are running a variety of Linux distribution. I am setting up a folder to store python scripts for other people to use on any one of our servers. I realize the python does this compiling on runtime. And I think it saves the compiled version in __pycache__. This leads me to believe that this can be in issue if different servers with different operating systems are accessing the same file. Is this going to be an issue or should a have a duplicate folder for each operating system?
Reply
#2
As far as I know, the __pycache__ mechanism is used for imported modules, not for scripts executed as main programs.

If nothing else works, starting with Python 3.8, you can perhaps set the sys.pycache_prefix on each server, for example in the sitecustomize.py file. Thus each server could define where it wants to store its cached python modules.

Python stores bytecode-compiled modules in the __pycache__ directory. Bytecode depends on the version of Python used, but the mechanism adds a suffix to the module names to distinguish the different versions, for example on my system, if I have a module spam.py, it writes spam.cpython-38.pyc in the pycache directory. This makes me believe that it should not be an issue and you should try to share the cache before attempting something else.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Using a script to open multiple shells? SuchUmami 9 429 Apr-01-2024, 10:04 AM
Last Post: Gribouillis
  python convert multiple files to multiple lists MCL169 6 1,521 Nov-25-2023, 05:31 AM
Last Post: Iqratech
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,177 Jun-29-2023, 11:57 AM
Last Post: gologica
  Python modules for accessing the configuration of relevant paths Imago 1 1,363 May-07-2022, 07:28 PM
Last Post: Larz60+
  Running script on multiple files Afrodizzyjack 1 2,499 May-14-2021, 10:49 PM
Last Post: Yoriz
  “NameError” “is not defined” script that I know works on other computers iamwithstupid 0 2,508 Nov-24-2020, 04:23 PM
Last Post: iamwithstupid
  List index out of range error while accessing 2 lists in python K11 2 2,098 Sep-29-2020, 05:24 AM
Last Post: K11
  Accessing IP Cam Audio In Python Haselsmasher 1 5,455 Jul-10-2020, 02:59 AM
Last Post: kiliantics
  Python: Automated Script to Read Multiple Files in Respective Matrices Robotguy 7 4,170 Jul-03-2020, 01:34 AM
Last Post: bowlofred
  How to kill a bash script running as root from a python script? jc_lafleur 4 5,870 Jun-26-2020, 10:50 PM
Last Post: jc_lafleur

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020