I am trying to add some diagnostics in shutil.py which is within the bundled python release in Plex Media Server - python27.zip
I thought I could just save the current python27.zip, unzip it, make the change to add some extra logging, re-zip the python27.zip and place it in the Windows 7 Program Files path for Plex Media Server and then start Plex Media Server.
Can this work?
I am asking because after making the change the com.plexapp.system did not start
Is it because of my changed code being incompatible with the existing python27.dll
Process Monitor shows PlexScriptHost.exe reading the new python27.zip
and then an IRP_MJ_QUERY_INFORMATION action on python27.dll
I am sorry I do not know anything about the python environment - but can add diags
I am just adding lines like these (trying to figure out why rmtree is failing - it relates to this thread in PlexPASS preview forum)
The python27.dll is of course left unchanged and has a date/timestamp of 9th April 2014 16:28
I have now went back to using the issued python27.zip
I unzipped / edited shutil.py and re-zipped using 7-zip with *.zip option for producing archive
Edit:
To trap the problem I am trying to add debug logging for in python, ideally want to run Microsoft SysInternals handle.exe on the target folder/file path at that point in time and log the output from that as well. But my knowledge of python is nil so cannot add lines of code to run the external exe and pipe its output to the logger. Also should log list of the contents before calling os.rmdir But if anyone would like to help me with that, would be really appreciated. Such diagnostics would benefit other similar errors that I have seen reported on the forums
As I thought, the method you've made your changes to, rmtree(), doesn't have the logger variable defined. So Python is throwing an error when it reaches that part of the script. Your changes won't work unless the function that calls rmtree() also passes in a logger, so I'm afraid you can't just simply add logger lines. Instead you will have to add your own logging method. It might be easier to print what you want logged to a file.
As I thought, the method you've made your changes to, rmtree(), doesn't have the logger variable defined. So Python is throwing an error when it reaches that part of the script. Your changes won't work unless the function that calls rmtree() also passes in a logger, so I'm afraid you can't just simply add logger lines. Instead you will have to add your own logging method. It might be easier to print what you want logged to a file.
yes please.... i have edited my post as you were responding adding to what ideally i want to see output for. Would appreciate any help. But logger was already used in shutils. So it is function dependent.
It could be because some of my uploaded diagnostics originated from these areas and may be dropbox keeps on checking the uploaded version is in sync with the source - but it should not be syncing with source. I need to look into how Dropbox works.I will look into Dropbox Sync - I do not think I am using it for uploaded items as the only sync I expect to be between uploaded content and the local Dropbox folder rather than the source folders. But the access by Dropbox to my Plex areas is worrying and should not be happening.
Nevertheless, it would be nice for the future to be able to add extra diagnostic logging in python27.zip modules or Plex Media Server bundles - so any feedback on what I was after would be welcome