Comments (17)
Yes, feel free to set up a pull request.
from mathbin.
I have no clue what you are talking about.
from mathbin.
Calling doi2pdf
now runs without an error.
It creates a template file, but not a pdf file in the folder I am in.
Copying said template file and renaming it to a pdf yields the correct pdf.
So something in the final copying does not work on Mac OS.
But I can currently not see where this is done, since shell/php/python is quite a mix and the php code is quite long with a lot of functions, none of which have documented functionality.
from mathbin.
Please give some sensible information. For example, what is the output of doi2pdf
?
from mathbin.
Well, I had to check myself first, here's one that provides more information and not just output without an error
❯ doi2pdf 10.1007/978-3-319-68445-1_6
Traceback (most recent call last):
File "/Users/ronnber/Repositories/numapde/numapde-bibliography/mathbin/doi2pdfname.py", line 9, in <module>
tree = etree.parse(sys.argv[1], parser=parser)
File "src/lxml/etree.pyx", line 3521, in lxml.etree.parse
File "src/lxml/parser.pxi", line 1859, in lxml.etree._parseDocument
File "src/lxml/parser.pxi", line 1885, in lxml.etree._parseDocumentFromURL
File "src/lxml/parser.pxi", line 1789, in lxml.etree._parseDocFromFile
File "src/lxml/parser.pxi", line 1177, in lxml.etree._BaseParser._parseDocFromFile
File "src/lxml/parser.pxi", line 615, in lxml.etree._ParserContext._handleParseResultDoc
File "src/lxml/parser.pxi", line 725, in lxml.etree._handleParseResult
File "src/lxml/parser.pxi", line 654, in lxml.etree._raiseParseError
File "/tmp/2368618976", line 1
lxml.etree.XMLSyntaxError: Document is empty, line 1, column 1
INFO: This is doi2pdf 2017.1!
INFO: checking for php wrappers (should be all yes):
INFO: - openssl: yes
INFO: - http: yes
INFO: - https: yes
INFO: Fetching http://dx.doi.org/10.1007/978-3-319-68445-1_6
INFO: Fetching https://dx.doi.org/10.1007/978-3-319-68445-1_6
INFO: Fetching http://link.springer.com/10.1007/978-3-319-68445-1_6
INFO: Fetching https://link.springer.com/10.1007/978-3-319-68445-1_6
INFO: Fetching https://link.springer.com/chapter/10.1007%2F978-3-319-68445-1_6
INFO: Fetching https://idp.springer.com/authorize?response_type=cookie&client_id=springerlink&redirect_uri=http%3A%2F%2Flink.springer.com%2Fchapter%2F10.1007%252F978-3-319-68445-1_6
from mathbin.
I don't think that this is the entire output.
from mathbin.
Well, that's all that is in my terminal, what are you missing?
from mathbin.
Invested some time and it might be curl
does not work properly, so now doi2pdfname does actually work, but I am back to output without an error message (see below) that still does not do the final copy from said tmp file to the right place&name.
❯ doi2pdf 10.1007/978-3-319-68445-1_6
INFO: This is doi2pdf 2017.1!
INFO: checking for php wrappers (should be all yes):
INFO: - openssl: yes
INFO: - http: yes
INFO: - https: yes
INFO: Fetching http://dx.doi.org/10.1007/978-3-319-68445-1_6
INFO: Fetching https://dx.doi.org/10.1007/978-3-319-68445-1_6
INFO: Fetching http://link.springer.com/10.1007/978-3-319-68445-1_6
INFO: Fetching https://link.springer.com/10.1007/978-3-319-68445-1_6
INFO: Fetching https://link.springer.com/chapter/10.1007%2F978-3-319-68445-1_6
INFO: Fetching https://idp.springer.com/authorize?response_type=cookie&client_id=springerlink&redirect_uri=http%3A%2F%2Flink.springer.com%2Fchapter%2F10.1007%252F978-3-319-68445-1_6
INFO: Fetching http://link.springer.com/chapter/10.1007%2F978-3-319-68445-1_6
INFO: Fetching https://link.springer.com/chapter/10.1007%2F978-3-319-68445-1_6
INFO: Fetching https://link.springer.com/content/pdf/10.1007%2F978-3-319-68445-1.pdf
INFO: PDF/PS found at https://link.springer.com/content/pdf/10.1007%2F978-3-319-68445-1.pdf
INFO: Writing contents to /tmp/312914748,
from mathbin.
This just means that doi2pdfname
failed to produce a pdf name, see https://github.com/gerw/mathbin/blob/master/doi2pdf#L65. Hence, doi2pdf
just saves the pdf in a temporary file.
from mathbin.
The -z
means empty? Hm, but
❯ doi2pdfname.sh 10.1007/978-3-319-68445-1_6
Nielsen_Barbaresco_Celledoni_Eidnes_Eslitzbichler_Schmeding_Celledoni_Eidnes_Eslitzbichler_Schmeding__Geometric_Science_of_Information_BOOK.pdf
Produces a name – ok it includes both the editors (the first two) and the authors, but that's a detail; so it does produce a name.
Edit: Yes compared to above, I updated/changes curl; I might add a file here explaining how Mac OS users can use this nice script collection.
from mathbin.
Are the variables $DOI
and $FN
in doi2pdf
assigned correctly?
from mathbin.
Yes. If I do a echo $DOI
directly after its definition (ie. after line 54) and similarly a echo $FN
after line 62 the beginning of the output is
❯ doi2pdf 10.1007/978-3-319-68445-1_6
10.1007/978-3-319-68445-1_6
Nielsen_Barbaresco_Celledoni_Eidnes_Eslitzbichler_Schmeding_Celledoni_Eidnes_Eslitzbichler_Schmeding__Geometric_Science_of_Information_BOOK.pdf
INFO: This is doi2pdf 2017.1!
[...]
from mathbin.
And the file is still saved at the wrong place? Strange.
Is $filename
correct at https://github.com/gerw/mathbin/blob/master/doi2pdf.php#L532 ??
from mathbin.
The tmp file is created correctly but the final move/copy does not seem to happen.
The filename printed with write_info($filename);
seems to be correct, yes. I will further investigate tonight.
from mathbin.
There is no copying involved. The filename is passed to scan_for_pdf
(https://github.com/gerw/mathbin/blob/master/doi2pdf.php#L533) and then the file is saved directly there: https://github.com/gerw/mathbin/blob/master/doi2pdf.php#L343.
Your observed behavior seems to be very strange.
from mathbin.
It seems to have been some strange behaviour in curl or something. Installing curl via brew (again) has solved the problem. Should I maybe add a small part to the Readme how one can use this nice collection of scripts also with Mac OS?
from mathbin.
I added #7 which finishes this issue.
from mathbin.
Related Issues (8)
- Prohibited characters in filenames
- Use bibtool to change the key in arxive2bib HOT 1
- Problems with `doi2pdf` on Mac OS HOT 2
- Implement informed file name suggestions for HAL preprints
- Error with lxml on Mac OS Big Sur HOT 4
- Error for some special characters when running `doi2pdf` HOT 2
- doi2bibtex replaces "\t" by a tab
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mathbin.