Pears

Intro

Below you can find a set of questions and answers I imagine might be useful. If your question/concern is not addressed below, don't hesitate to contact me. Please use the facilities on the Sourceforge page to submit bug reports, patches and such.

pearsdebug.py

What is pearsdebug.py?
This is a plain text file which can contain arbitrary Python code. It allows changing Pears settings which are not accessible from the GUI, yet without requiring you to change the actual program code. The general policy is this: a setting which may be switched on/off more than once in the lifetime of the application ends up in the GUI, other settings end up only being customizable using the pearsdebug.py file. This file is not deleted by the Windows uninstall procedure, so you can keep it around forever.

This file is not strictly speaking needed, you'll usually only need to use it if you want to change some relatively obscure settings.

Note that everything in this file is case- and indentation-sensitive. Always start typing at the beginning of the line and type exactly what is specified in this help file.
How can I make this file?
Open your favorite plain-text editor (e.g. Notepad, but not Word). Write whatever you need to write and save it to a directory where Python might pick it up.
Where should I put it?
The most obvious place to put it is the Pears directory itself. It will work, it will never be overwritten by a new Pears version and all should be well. This is the best way to do it, presuming you make sure you always install a new Pears version in the same directory as the old one.

However, if you often change the directory where you put Pears in (e.g. you install each version in a different directory), that would mean you'd have to copy the pearsdebug.py file around all the time. So in this case you might opt for putting the file in the directory where Python keeps its libraries. If you don't know where that one is, search your HD for zipfile.py.

But that's not ideal neither, since you'll have to move the file if you install a new Python version in a different directory. So the safest (and most cumbersome) way of all is to put the file in some directory you're sure will always stay there and then add this directory to the PYTHONPATH environment variable.

Stability and performance

Pears is very slow/consumes a lot of memory.
First make sure Paranoid saving is switched off in the Options menu.

If that doesn't solve the problem, you can either set your cache sizes lower or use Mark Moraes' hamster engine. To do this, write in the pearsdebug.py file:
HAMSTERMODE = True
Note that conversion from the default engine to the hamster engine format is automated, but there is no automated way to convert back without losing your cached items. To switch back, set:
HAMSTERMODE = False
Pears freezes when it downloads feeds. Is this normal?
For very small amounts of time (up to 10 seconds in extreme cases), this is possible and does not indicate malfunctioning.
Pears sometimes hangs when downloading. What can I do about it?
Please let me know if this happens!

The easiest way to fix this is to empty all feeds (Ctrl+E).
If however you are attached to your cache, write in the pearsdebug.py file:
SIMULTANEOUSUPDATE = 1
Then start Pears from a console by running python pears.py. You'll see:
Updating 0
Done 0
Updating 1
Done 1
...
Updating X
<some error message>
Write X down, remove the SIMULTANEOUSUPDATE = 1 from the pearsdebug.py file and restart Pears. Count the feeds starting from 0 and when you find X, empty it (Ctrl+D).
I have a very fast/very slow connection and I'd like to change the number of simultaneous feeds being downloaded.
Write in the pearsdebug.py file:
SIMULTANEOUSUPDATE = 2
The number (2) can be anything you like. 4 is default and is a very smart value, suitable for classic modems or ADSL/cable connections. Higher values can be useful for very fast connections, lower ones for extremely slow ones.
Pears doesn't work. Why?
There are different reasons why Pears might not work, as outlined below.

Make sure you don't already have a copy Pears running. It's not possible to run two of them at once for the same user, because that could be a source of problems regarding the integrity of the saved data.

Pears requires Python 2.2 and wxPython 2.4.0.7 to work. I've had reports that it works with wxPython 2.4.0.2 too, but I can't guarantee anything for older ones. Either way, make sure you have both Python and wxPython installed and neither of them is too old. If your version is reasonably recent (Python >2.2 and wxPython >2.4) and it still doesn't work, please look at the question regarding crashes, because I'd like Pears to work on those releases.
Pears crashes. Why?
No public release of Pears has ever crashed on me. I introduced timing in version 0.8 and my copy (1 day old at the time of this writing) has been running for more than 172h without any problems. There are two possibilities: either your version of Python and/or wxPython is broken or old, or Pears indeed has a problem. Start Pears from a console and send me the message it displays in the console when it crashes. Please also specify your Python and wxPython version (they are shown in the About screen as well).

Windows users: to get the console, go to Start -> Run and run cmd (in 2k/XP) or command (9x). Then type c: (or whatever drive you installed Pears on followed by :), then cd c:\program files\pears (or whatever directory you installed it to). The prompt should change to show the new location. Then type pears.py or python pears.py.

Storage

Is it possible to save data in another directory (not the default one)?
Yes. Write in the pearsdebug.py file:
savedir = "c:/somedir/somesubdir/"
(replace c:/somedir/somesubdir/ with the path where you wish to save the data; Windows users should pay attention to the use of forward slashes). Note that using a hard-coded path like this might mean Pears works the same and has the same feeds for all users on your system.
Help, all my data has disappeared!
This most likely means that the value of your $HOME environmental variable has changed. This variable should always point to the home directory of the current user (under WinXP, this is Documents and Settings/<Username>). You can either change the HOME environmental variable to point to this folder again, or you can look in the About screen to find out where your data is now and move the old data files to there (make sure Pears is not running when you're doing this!). Alternatively, you could also use the solution provided on this page for saving data in a non-default directory.
Can I import other people's .pyrs files into my own?
Not directly. pyrs files are essentially Python code which gets evaluated. As long as you let Pears manipulate them on its own, they should be safe. However, if you manipulate them manually, or you try to import other people's files, Pears has no control over them any more. These files are not by definition trustworthy, so I've decided to not implement an import/export mechanism for them. However, exchange of feeds with other users is possible using XML formats.

If you're wondering about the reasons for this choice, they're quite simple: I like being able to manipulate the saved data manually (pickling or some database solution is not suitable), I want the solution to work with the built-in batteries of Python 2.2 (CSV module is only included in Python 2.3) and I don't want to reinvent the wheel (roll my own solution). In the case of Pears I find using eval() is not an additional risk: the entire program is distributed in source form, so if someone has access to the saved files, he/she also has access to the program itself and could modify pears.py directly to do damage.

Misc

How long did it take to make?
I've kinda lost track of the time I spent on Pears. You can follow developments by checking out the history on my website. Obviously I don't work full-time on it.
I erased my items cache and now some feeds will not send me their items. What can I do?
Pears uses bandwidth saving techniques: it stores some tags about the feeds it downloads and sends those tags back when it updates. Based on these, feeds which support this feature can find out if anything new was added since Pears last downloaded the feed. If nothing new was added, nothing is sent back. It saves you time and it saves the feed author money.
Now if you delete your topics cache, the tags mentioned above are still present. You can get rid of them by going to the Options menu. Under Advanced you'll find an item for dumping the etag/modified tags. Click on it, then refresh your feeds normally.
Can you put feature X in Pears?/I found a bug, will you repair it?
Feel free to contact me with your requests or bug reports.
I am open to adding new features, based on whether I think they're useful to anyone but yourself and on whether their degree of usefulness justifies the development time that will go into them.
Regarding bugs, note that Windows XP is my main platform and though I check to see if Pears runs ok on Linux, some bugs only really are detectable if the application is used for longer periods of time. I will probably find any bugs like that if they appear in Windows XP, but I probably won't find them if they only appear in Linux or other Windows versions. That being said, the application is identical for all platforms, so platform-specific issues should be rare or non-existant. Pears is very stable in my experience and I'd like it to be very stable in every user's experience, regardless of the platform. As you can see by looking at the history of the 0.7.x releases, I'm willing to spend quite some time improving its functionality on other platforms.
© 2003, 2004 Project 5