Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make beginner-friendly guide on how to use #27

Open
MasterScrat opened this issue Sep 13, 2018 · 17 comments
Open

Make beginner-friendly guide on how to use #27

MasterScrat opened this issue Sep 13, 2018 · 17 comments

Comments

@MasterScrat
Copy link
Owner

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
Copy link
Owner Author

Maybe a Colab notebook?

@teamfridge
Copy link

+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!

@MasterScrat
Copy link
Owner Author

Sorry to hear!

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

@sheikheddy
Copy link

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

@teamfridge
Copy link

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!

@sheikheddy
Copy link

sheikheddy commented Jan 18, 2020

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

@teamfridge
Copy link

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

@mar-muel
Copy link
Collaborator

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.

@sheikheddy
Copy link

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

@HaydenSchilling
Copy link

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'

@sheikheddy
Copy link

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.

@HaydenSchilling
Copy link

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

@sheikheddy
Copy link

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 ?

@HaydenSchilling
Copy link

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

@sheikheddy
Copy link

This is definitely strange.

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

if len(glob.glob(os.path.join(file_path, '**', '*.json'))) == 0:
log.error(f'No input files found under {file_path}')
exit(0)

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

files = glob.glob(os.path.join(file_path, '*.txt'))
if len(files) == 0:
log.error(f'No input files found under {file_path}')
exit(0)

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!

@HaydenSchilling
Copy link

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

@kenyeresrudolf
Copy link

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants