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

coercing to Unicode: need string or buffer, PosixPath found #18

Open
ignaspakamore opened this issue Apr 23, 2020 · 1 comment
Open

Comments

@ignaspakamore
Copy link

Hi,
when trying to set settings in jupyter notebook:
settings = Settings(fn_yaff='pars_cov.txt', plot_traj='All', xyz_traj=True)
The following error occurred:


TypeError Traceback (most recent call last)
in ()
----> 1 settings = Settings(fn_yaff='pars_cov.txt', plot_traj='All', xyz_traj=True)

/Users/ignaspakamore/Anaconda/anaconda2/lib/python2.7/site-packages/quickff/settings.py in init(self, fn, **kwargs)
166 #first read general RC settings from .quickffrc file
167 with path('quickff.data', 'quickffrc') as fn_default:
--> 168 self.read_config_file(fn_default)
169 #if a config file is provided, read settings from this file and
170 #overwrite the default RC settings

/Users/ignaspakamore/Anaconda/anaconda2/lib/python2.7/site-packages/quickff/settings.py in read_config_file(self, fn)
190
191 def read_config_file(self, fn):
--> 192 with open(fn, 'r') as f:
193 for iline, line in enumerate(f.readlines()):
194 line = line.split('#')[0].lstrip().rstrip().rstrip('\n')

TypeError: coercing to Unicode: need string or buffer, PosixPath found

@lvduyfhu
Copy link
Member

lvduyfhu commented Nov 9, 2020

Dear ignaspakamore,

first of all, thank you for reporting this and sorry for the late reply. This might have to do with compatibility between python 3 and python 2. If this still is an issue, maybe the following small hack in the source code of QuickFF could work.

In the line 168 of settings.py mentioned in the second paragraph of your traceback, change the line
self.read_config_file(fn_default)

to the line
self.read_config_file(str(fn_default))

and reinstall QuickFF.

cheers,
Louis

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

No branches or pull requests

2 participants