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

CSV file name issue when ':' is used #51

Closed
lukmuk opened this issue Dec 4, 2024 · 2 comments
Closed

CSV file name issue when ':' is used #51

lukmuk opened this issue Dec 4, 2024 · 2 comments

Comments

@lukmuk
Copy link

lukmuk commented Dec 4, 2024

Hello Fernando,

thanks for this great tool! The following issue might be Windows-specific (version 1.0.6).
When using a keyword/query with :, no csv file is saved since the : is probably not allowed in a file name.

Example query using site: to seach a specific journal/publisher:
sortgs "'Grünewald' AND 'Hänisch' site:iopscience.iop.org" --nresults 10

Will correctly list the publications...
grafik

(search link)

but an empty file (truncated at : position) is created in Windows:
grafik

The same query works fine in the Colab notebook, where the : is replaced by an underscore _.

Maybe a check for the csv filename has to be performed for Windows or you could add an option that allows to specify the filename of the csv-output?

Thank you for any help!

@lukmuk
Copy link
Author

lukmuk commented Dec 6, 2024

To fix it I changed the following line:
fpath_csv = os.path.join(path,keyword.replace(' ','_')+'.csv')
https://github.com/WittmannF/sort-google-scholar/blob/master/src/sortgs/sortgs.py#L340
to
fpath_csv = os.path.join(path,keyword.replace(' ','_').replace(':','_')+'.csv')

to replace : by _.

@WittmannF
Copy link
Owner

Thanks for the catch @lukmuk ! Fixing it now

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