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

Where do I run the script? #2

Open
oliviaguest opened this issue Nov 28, 2019 · 31 comments
Open

Where do I run the script? #2

oliviaguest opened this issue Nov 28, 2019 · 31 comments

Comments

@oliviaguest
Copy link
Member

In order to publish a new article (after acceptance), you'll need to have the article metadata file (YAML format) and the corresponding article (PDF format). 

Is best practice to take the YAML and PDF and drop them in the same directory as the Python scripts?

@rougier
Copy link
Member

rougier commented Nov 28, 2019

Yes, it makes the command line shorter to write but you're actually free to put them anywhere. But you'll have to run the sciprt from the "articles" directory because it will create a local archive of the paper (through some automatic github command).

@oliviaguest
Copy link
Member Author

This should be clarified somewhere for people like me who have no idea, I guess. 😆

@rougier
Copy link
Member

rougier commented Nov 28, 2019

Yes, I realize the procedure needs more explanation. After you finished editing this one, I'll try to update explanation based on your feedback.

@oliviaguest
Copy link
Member Author

I added this, but I am not sure how to clarify the rest since I am not sure I understand the rest enough, yet... Sorry! 42fb65e

@rougier
Copy link
Member

rougier commented Dec 1, 2019

Thanks. I'll try to update by next week based on your (bad) experience. Sorry for all the mess. Did you manage to publish the article finally ?

@oliviaguest
Copy link
Member Author

I'm not sure what I'm supposed to do next... is the author meant to take over at some point?

@rougier
Copy link
Member

rougier commented Dec 1, 2019

You have to check the final PDF is ok (DOI, editors, replication (and not editorial)), lnks, etc. If it's fine, you can now publish it on Zeonodo using the script. Note that in cas of problem, you still have the option to edit it directly on Zenodo.

@oliviaguest
Copy link
Member Author

A good thing would be to make very clear which bits the editor needs to do and which the authors and possibly send the authors a link to it (if we don't already?) so they can prep their end as soon as they can... would that be useful?

@rougier
Copy link
Member

rougier commented Dec 2, 2019

Yes. One question we had with @khinsen is whether the editor fills up the metadata and make a PR to author's repository or whether the author fills up metadata and rebuild the PDF. Since editor is more experienced, the first solution might be easier.

@oliviaguest
Copy link
Member Author

Another thing is the situation I am in now where I cannot compile the PDF. Is this OK or does it just mean asking the authors to do too much back-and-forth and taking too long?

@oliviaguest
Copy link
Member Author

Also a link to a fully working (toy?) example would be good for the YAML file. Maybe even for the whole article repo? So we can know what it should look like?

@oliviaguest
Copy link
Member Author

oliviaguest commented Dec 4, 2019

I'm getting a bug (?):

Metadata is newer than PDF, probably PDF needs to be rebuild

Apart from the typo which I'll fix now, I don't think it's correct to have this blocking since I can't build the PDF from the Metadata in this case anyway...

@oliviaguest
Copy link
Member Author

And now I get this issue — any ideas?

(base) olivia@olivia-HP-Z2-Tower-G4-Workstation:~/Code/articles$ python publish.py --sandbox --metadata ../WCSTDehaeneChangeux/Metadata.yaml --pdf ../WCSTDehaeneChangeux/ReScience_Dehaene.pdf 
Traceback (most recent call last):
  File "publish.py", line 196, in <module>
    article = Article(file.read())
  File "/home/olivia/Code/articles/article.py", line 135, in __init__
    self.parse(data)
  File "/home/olivia/Code/articles/article.py", line 170, in parse
    document = yaml.safe_load(data)
  File "/home/olivia/anaconda3/lib/python3.7/site-packages/yaml/__init__.py", line 162, in safe_load
    return load(stream, SafeLoader)
  File "/home/olivia/anaconda3/lib/python3.7/site-packages/yaml/__init__.py", line 114, in load
    return loader.get_single_data()
  File "/home/olivia/anaconda3/lib/python3.7/site-packages/yaml/constructor.py", line 41, in get_single_data
    node = self.get_single_node()
  File "/home/olivia/anaconda3/lib/python3.7/site-packages/yaml/composer.py", line 36, in get_single_node
    document = self.compose_document()
  File "/home/olivia/anaconda3/lib/python3.7/site-packages/yaml/composer.py", line 55, in compose_document
    node = self.compose_node(None, None)
  File "/home/olivia/anaconda3/lib/python3.7/site-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/home/olivia/anaconda3/lib/python3.7/site-packages/yaml/composer.py", line 133, in compose_mapping_node
    item_value = self.compose_node(node, item_key)
  File "/home/olivia/anaconda3/lib/python3.7/site-packages/yaml/composer.py", line 82, in compose_node
    node = self.compose_sequence_node(anchor)
  File "/home/olivia/anaconda3/lib/python3.7/site-packages/yaml/composer.py", line 111, in compose_sequence_node
    node.value.append(self.compose_node(node, index))
  File "/home/olivia/anaconda3/lib/python3.7/site-packages/yaml/composer.py", line 84, in compose_node
    node = self.compose_mapping_node(anchor)
  File "/home/olivia/anaconda3/lib/python3.7/site-packages/yaml/composer.py", line 127, in compose_mapping_node
    while not self.check_event(MappingEndEvent):
  File "/home/olivia/anaconda3/lib/python3.7/site-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/home/olivia/anaconda3/lib/python3.7/site-packages/yaml/parser.py", line 428, in parse_block_mapping_key
    if self.check_token(KeyToken):
  File "/home/olivia/anaconda3/lib/python3.7/site-packages/yaml/scanner.py", line 116, in check_token
    self.fetch_more_tokens()
  File "/home/olivia/anaconda3/lib/python3.7/site-packages/yaml/scanner.py", line 223, in fetch_more_tokens
    return self.fetch_value()
  File "/home/olivia/anaconda3/lib/python3.7/site-packages/yaml/scanner.py", line 579, in fetch_value
    self.get_mark())
yaml.scanner.ScannerError: mapping values are not allowed here
  in "<unicode string>", line 62, column 80:
     ...  The Wisconsin Card Sorting Test: Theoretical analysis and model ... 
                                         ^

@rougier
Copy link
Member

rougier commented Dec 5, 2019

Maybe missing quote around the string or maybe you need to escape the : (→ \:)

@oliviaguest
Copy link
Member Author

OK, but now I get this...

(base) olivia@olivia-HP-Z2-Tower-G4-Workstation:~/Code/articles$ echo $ZENODO_SANDBOX_TOKEN
[redacted]
(base) olivia@olivia-HP-Z2-Tower-G4-Workstation:~/Code/articles$ python publish.py --sandbox --metadata ../../Articles/WCSTDehaeneChangeux/Metadata.yaml --pdf ../../A
rticles/WCSTDehaeneChangeux/ReScience_Dehaene.pdf
Uploading content to Zenodo... Traceback (most recent call last):
  File "publish.py", line 204, in <module>
    upload_content(server, token, article_id, article_file)
  File "publish.py", line 25, in upload_content
    raise IOError("%s: " % response.status_code + response.json()["message"])
OSError: 405: The method is not allowed for the requested URL.

@rougier
Copy link
Member

rougier commented Dec 9, 2019

You're using the Zenodo sandbox with the sandbox DOI or the actual DOI ?

@oliviaguest
Copy link
Member Author

Ah, to test this I need to generate/paste a sandbox DOI and edit the metadata and PDF files?

@rougier
Copy link
Member

rougier commented Dec 9, 2019

Yes, the DOI you get from sandbox and actual server are not the same and might be the problem.

@oliviaguest
Copy link
Member Author

Fixed DOI, etc., now I get this:

found unknown escape character ':'
  in "<unicode string>", line 8, column 46:
     ... The Wisconsin Card Sorting Test\: an implementation of Dehaene a ...

@oliviaguest
Copy link
Member Author

The line in the metadata is now:

title: "[Re] The Wisconsin Card Sorting Test\: an implementation of Dehaene and Changeux Neuronal Network Model"

@oliviaguest
Copy link
Member Author

I have tried various ways of escaping the colon to no success! 😕 All here have been tested: https://stackoverflow.com/questions/11301650/how-to-escape-indicator-characters-i-e-or-in-yaml

@rougier
Copy link
Member

rougier commented Dec 9, 2019

Ok, we need to change the title that is wrong anyway. The title of the replication should be "[Re] original title" (this is for search engines to (also) match the replication when people look for the original article).

@oliviaguest
Copy link
Member Author

So the title should be, which still has a colon in it:

[Re] The Wisconsin Card Sorting Test: Theoretical analysis and modeling in a neuronal network

@rougier
Copy link
Member

rougier commented Dec 9, 2019

Arrrggg.... Can you try with this (unicode fullwidth colon, make sure to copy it), or else, we can use a comma instead

@oliviaguest
Copy link
Member Author

Same error(s) with the different combinations of escaping the Unicode colon.

@rougier
Copy link
Member

rougier commented Dec 9, 2019

Even without escaping it at all ?

@oliviaguest
Copy link
Member Author

Yup, the error is then:

yaml.scanner.ScannerError: mapping values are not allowed here
  in "<unicode string>", line 62, column 80:
     ...  The Wisconsin Card Sorting Test: Theoretical analysis and model ...

@oliviaguest
Copy link
Member Author

It doesn't care about the pasted single-space Unicode colon at all. It just replaces it — it seems — with a standard colon.

@rougier
Copy link
Member

rougier commented Dec 9, 2019

So let's use a comma and you can keep the right title in the tex/pdf and change the title later directly on Zenodo. I'll need to fix the problem at some point.

@oliviaguest
Copy link
Member Author

Aaaahhh, I figured it out. I was confusing the line numbers! Both original and current title had colons! OK, I used the standard way of fixing both colons, and it's fine! https://sandbox.zenodo.org/record/416801

@oliviaguest
Copy link
Member Author

And: https://zenodo.org/record/3545905 💯

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