#1
|
|||
|
|||
Module caching
Hi,
I wrote my own module to use with my scripts in SecureCRT. It's still in active development, I test the module by running scripts that use it. However it looks like SecureCRT caches the module somewhere because the changes I make to the module are not reflected as fast as I'd expect. I thought that restarting the session that has a script that uses the module attache would be enough to reinitialize it. That wasn't the case. Then I noticed that a <module>.pyc file is created, so I figured that's the file that is used when I reconnect. However erasing it didn't help. Even restarting SecureCRT and erasing the .pyc file doesn't help. When I change the script that's attached to the session (or called by a mapped key) I notice the changes immediately after reconnecting the session. The issue is only with modules called inside the script. Can you shed some light on the script initialization process in SecureCRT? Cheers! Alex. |
#2
|
|||
|
|||
Hi Alex,
Have you tried reload(module_name)?
__________________
Thanks, --Brenda VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#3
|
|||
|
|||
Hi Brenda,
Where should I try it exactly? |
#4
|
|||
|
|||
Hi Alex,
You might try searching Python documentation and other internet resources for answers to Python-specific questions. The one statement I did find on Python's website: Quote:
__________________
Thanks, --Brenda VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#5
|
|||
|
|||
Hi Brenda,
The question is relevant here since SecureCRT controls the interpreter. Reload command makes sense if I use a python console, which I don't (can't really with SecureCRT). It doesn't make sense to add the reload(<module>) command to the script itself. In my understanding the interpreter should stop once a script is finished. The behavior I'm seeing is that SecureCRT doesn't restart the interpreter even when I close the application and open it again. Is that correct? Last edited by metallicat; 10-09-2017 at 09:03 PM. |
#6
|
|||
|
|||
Hi Alex,
SecureCRT does cache the module as long as it is running. If you are seeing behavior where the cache is not cleared after quitting/restarting SecureCRT then perhaps we need further details regarding your installation. (What version of SecureCRT? On what OS? etc.) You should be adding reload() following import as shown in this post. You may also need to make use of the variable PYTHONDONTWRITEBYTECODE as explained in these posts on Stack Overflow: http://stackoverflow.com/questions/1...instead-of-pyc
__________________
Thanks, --Brenda VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#7
|
|||
|
|||
I'm running version 8.3.0 (build 1474) on MacOS Sierra 10.12.5.
Python version 2.7.10. |
#8
|
|||
|
|||
__________________
Thanks, --Brenda VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#9
|
|||
|
|||
Thanks, Brenda.
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | Rate This Thread |
|
|