LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-11-2018, 12:20 AM   #1
black-clover
Member
 
Registered: Jun 2017
Distribution: Devuan Daedalus, Debian Testing, SliTaz, Alpine Linux.
Posts: 206

Rep: Reputation: Disabled
Clear Python cache


Hello,

I have been trying to modify a config file in a program written in Python2 (Trelby).
A friend tried the modification on a virtual machine and it worked.
But, when I try it on the installed system, the program always loads the version of the file cached by Python.

So, the question is, how do I clear the python cache?
 
Old 05-11-2018, 12:59 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,840

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
usually python compiles the code and there will be a *.pyc file next to *.py. So if you modified a python source file probably you only need to remove the related *.pyc (although python handles it automatically).
If it was something else I think we have no idea what kind of cache are you talking about (I'm not really sure if it was really cache related issue).
There is no such thing "the python cache".
Would be nice to give more detailed info.
 
1 members found this post helpful.
Old 05-11-2018, 03:57 AM   #3
black-clover
Member
 
Registered: Jun 2017
Distribution: Devuan Daedalus, Debian Testing, SliTaz, Alpine Linux.
Posts: 206

Original Poster
Rep: Reputation: Disabled
Pan 64,
first off, thanks for the answer
I know nothing about python (you might have guessed that already).

The program in question is a WP called trelby.
My issue is changing the default position of the find/replace window.
I modified the file finddlg.py and a friend tested the code on a virtual machine and it worked.
When I made the same change in the installed program, it keeps setting the window the same way, no matter what I do.

I tried the following (all with the same result as above):

a-erase the old finddlg.py file and replace with the modified one.
b-recompile trelby after modifying the original sources in Debian and reinstalling it from scratch.
c-recompile trelby after modifying the original sources in Arch and reinstalling it from scratch.
d-as "c" but on a live CD.
e-as "c" but on a new install which downloaded python from newly as a dependency.
f-replace the finddlg.py with the modified one REMOVE finddlg.pyc.

My guess is that the original configuration is stored somewhere in the Trelby code that bypass the finddlg.py instructions.
My question is where that happens or how to find out.
 
Old 05-11-2018, 06:08 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,840

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
yes, that makes much more sense. Usually it is located in users' home dir, need to look for something like .trelby .config (or something similar). You need to cd into that directory and you will see the stored configuration.
Also you might find this useful: https://www.trelby.org/assets/manual.html#settings
 
1 members found this post helpful.
Old 05-11-2018, 11:55 AM   #5
black-clover
Member
 
Registered: Jun 2017
Distribution: Devuan Daedalus, Debian Testing, SliTaz, Alpine Linux.
Posts: 206

Original Poster
Rep: Reputation: Disabled
That's one of the first things I've done, but the home dir trelby config file deals with the text format and other stuff. No mention of window positioning.
Therefore, the suggested link, which deals with the possibility of using a different config file from .trelby, would not be any help.
 
Old 05-11-2018, 12:57 PM   #6
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,840

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
in that case unfortunately I have no better idea than:
1. analyze the python code to find out how does it work.
2. use strace or similar to find the files accessed.
3. ask the developers.
4. you may try to use another linux user.
 
1 members found this post helpful.
Old 05-11-2018, 03:06 PM   #7
black-clover
Member
 
Registered: Jun 2017
Distribution: Devuan Daedalus, Debian Testing, SliTaz, Alpine Linux.
Posts: 206

Original Poster
Rep: Reputation: Disabled
Yes, it's kind of baffling.
I tried to contact the developers but got no answer (trelby is a great app but not aggressively maintained).
Using another linux user doesn't help, it's something system-wide.
as for 1 & 2, they are above my level of knowledge.
 
Old 05-12-2018, 12:05 PM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,840

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
Quote:
Originally Posted by black-clover View Post
Using another linux user doesn't help, it's something system-wide.
But this information may help. In such cases the config files should be common, not stored in users' home. Probably in /etc, in /etc/trelby, or somewhere under /usr/local. It looks like trelby is installed into /opt/trelby, you may need to check that too.
In the documentation, chapter 8 you can find the following:
Code:
Trelby supports the following command line parameters:

--conf FILENAME

    Read global settings from the given file instead of "default.conf".
 
1 members found this post helpful.
Old 05-12-2018, 01:08 PM   #9
black-clover
Member
 
Registered: Jun 2017
Distribution: Devuan Daedalus, Debian Testing, SliTaz, Alpine Linux.
Posts: 206

Original Poster
Rep: Reputation: Disabled
I solved this, at least.
the only common denomnator was the theme I used, which missed the applets.
Drove me crazy for days but finally found the culprit, LOL.
 
Old 05-13-2018, 12:28 AM   #10
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,840

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
good the hear that.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to clear cache Qas313 Linux - Server 11 01-25-2017 09:56 AM
Clear buffer and cache. anandg111 Linux - Newbie 3 07-10-2015 04:40 AM
How to clear apache cache s_linux SUSE / openSUSE 5 02-04-2010 03:27 PM
how do you clear the cache? eagletalontim Linux - Newbie 11 01-11-2006 03:05 PM
Clear cache raysr Linux - Newbie 2 03-26-2004 01:34 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration