Chatistics icon indicating copy to clipboard operation
Chatistics copied to clipboard

Make beginner-friendly guide on how to use

Open MasterScrat opened this issue 7 years ago • 17 comments

Multiple people with little knowledge of Python have expressed interest in running the scripts.

There should be either a very simple guide or video, or a guided script that would let anyone render the final graphics.

MasterScrat avatar Sep 13 '18 08:09 MasterScrat

Maybe a Colab notebook?

MasterScrat avatar Jan 13 '20 15:01 MasterScrat

+1 any progress on this? Several hours deep and still not managed to get running, be great to find an easier (or any!) way to use this...thanks!

teamfridge avatar Jan 17 '20 17:01 teamfridge

Sorry to hear!

What problems are you hitting? Feel free to open issues for any kind of problem!

MasterScrat avatar Jan 17 '20 17:01 MasterScrat

I have a lot of experience with python, will jump into the repo and hopefully try to write a tutorial tomorrow.

sheikheddy avatar Jan 17 '20 18:01 sheikheddy

Sorry to hear!

What problems are you hitting? Feel free to open issues for any kind of problem!

Thanks! Not related to this project more general python modules and libraries issues, the kind that often generate the unhelpful response r/learnpython elsewhere...but if I identify something specific to this I will let you know. Thanks again!

teamfridge avatar Jan 18 '20 12:01 teamfridge

Hi, just made a tutorial part 0 to help with installing and setting up chatistics. It's based off of a handout I made for a course I TA'd for, so let me know if you'd like to change anything! tutorialpart0.pdf

Part 1 will be a colab notebook, any suggestions for what to include in it?

Edit: Will make a .ipynb notebook instead

sheikheddy avatar Jan 18 '20 14:01 sheikheddy

Got it working, thanks! Hit an obstacle with --own-name command not found, but skipped it by exporting two chats into the folder.

teamfridge avatar Jan 18 '20 16:01 teamfridge

I would prefer using Binder since maybe not all users are comfortable sharing their chat history with Google? Although I don't have strong opinions on this.

mar-muel avatar Jan 18 '20 17:01 mar-muel

Isn't Google Cloud one of the supporters of binder? Anyway, good point, I'll make it a notebook they can run locally.

sheikheddy avatar Jan 18 '20 18:01 sheikheddy

Any Progress on the tutorial for beginners? I am hitting issues which I think are very basic as I"m new to python.

When I try and run the script for messenger I get the following error.


%run Chatistics/parse.py messenger


KeyError                                  Traceback (most recent call last)
~\Chatistics\parse.py in <module>
      2 import sys
      3 
----> 4 from parsers.config import config
      5 from utils import ArgParseDefault
      6 

~\Chatistics\parsers\__init__.py in <module>
      1 import logging.config
      2 
----> 3 logging.config.fileConfig('logging.conf')

~\.conda\envs\Chatistics\lib\logging\config.py in fileConfig(fname, defaults, disable_existing_loggers)
     69             cp.read(fname)
     70 
---> 71     formatters = _create_formatters(cp)
     72 
     73     # critical section

~\.conda\envs\Chatistics\lib\logging\config.py in _create_formatters(cp)
    102 def _create_formatters(cp):
    103     """Create and return formatters"""
--> 104     flist = cp["formatters"]["keys"]
    105     if not len(flist):
    106         return {}

~\.conda\envs\Chatistics\lib\configparser.py in __getitem__(self, key)
    956     def __getitem__(self, key):
    957         if key != self.default_section and not self.has_section(key):
--> 958             raise KeyError(key)
    959         return self._proxies[key]
    960 

KeyError: 'formatters'

HaydenSchilling avatar Feb 02 '20 22:02 HaydenSchilling

Oh, that issue might be because python can't find your 'logging.conf' config file. This is defined inside the Chatistics directory, so since your current working directory is being searched the logging.conf isn't found. Try navigating to inside the Chatistics folder first and running the command again?

I haven't forgotten about making the tutorial, it's just been hard to motivate myself. I'll try to see if I can block off time this weekend to work on it.

sheikheddy avatar Feb 06 '20 23:02 sheikheddy

Thanks, That worked! but now I have another problem. I am getting an error with the names. :(

%run parse.py messenger
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
~\Chatistics\parse.py in <module>
     82 
     83 if __name__ == '__main__':
---> 84     ArgParse()

~\Chatistics\parse.py in __init__(self)
     40             parser.print_help()
     41             sys.exit(1)
---> 42         getattr(self, args.command)()
     43 
     44     def telegram(self):

~\Chatistics\parse.py in messenger(self)
     67                             help='Path to Facebook messenger chat log folder')
     68         args = parser.parse_args(sys.argv[2:])
---> 69         main(args.own_name, args.file_path, args.max)
     70 
     71     def whatsapp(self):

~\Chatistics\parsers\messenger.py in main(own_name, file_path, max_exported_messages)
     17     if len(glob.glob(os.path.join(file_path, '**', '*.json'))) == 0:
     18         log.error(f'No input files found under {file_path}')
---> 19         exit(0)
     20     if own_name is None:
     21         own_name = infer_own_name(file_path)

NameError: name 'exit' is not defined

HaydenSchilling avatar Feb 08 '20 06:02 HaydenSchilling

This error is due to a missing import, I've made a pull request to fix it.

Just to make sure, have you put the contents of the messages folder (from your FB JSON download) into Chatistics/raw_data/messenger ?

sheikheddy avatar Feb 08 '20 15:02 sheikheddy

Yes, that is correct, I have the json files in Chatistics/raw_data/messenger but I think you are on the right track, they are not being recognised as input files.

image

HaydenSchilling avatar Feb 10 '20 08:02 HaydenSchilling

This is definitely strange.

This is the code snippet that's responsible for it:

https://github.com/MasterScrat/Chatistics/blob/079fb531a685bdd7ead81dab97a855da5c749c39/parsers/messenger.py#L17-L19

Let's contrast this with the empty input file checker in the whatsapp parser:

https://github.com/MasterScrat/Chatistics/blob/079fb531a685bdd7ead81dab97a855da5c749c39/parsers/whatsapp.py#L70-L73

Notice that in os.path.join, the messenger one has an extra '**'. I bet if you removed this you would fix this particular error. It seems what's going on is that the code expects you to put the messages folder inside instead of the contents of the messages folder. This goes against what README.md says.

Thanks for pointing this out!

sheikheddy avatar Feb 10 '20 14:02 sheikheddy

Amazing, works fine now! I really appreciate all your help!

HaydenSchilling avatar Feb 10 '20 21:02 HaydenSchilling

Hey Guys,

IDK where is the error. After i downloaded the messenger data, copied into the raw_directory, created a venv in conda, set up a directory I tried to run parse.py messenger command (in anaconda terminal) , i still receive the following error. Could you please help me what could be the issue? Thank you a lot.

(chatistics) C:\Users\RUID2\Documents\PYProjects\Chatistics-master>python parse.py messenger Traceback (most recent call last): File "parse.py", line 84, in <module> ArgParse() File "parse.py", line 38, in __init__ if not hasattr(self, args.command): AttributeError: 'Namespace' object has no attribute 'command'

kenyeresrudolf avatar Nov 12 '20 12:11 kenyeresrudolf