ValueError: subformat not allowed for format jyear_str in Example
See original GitHub issueWhen running this code:
from poliastro.examples import molniya
molniya.plot()
I get this error:
WARNING: AstropyDeprecationWarning: The private astropy._erfa module has been made into its own package, pyerfa, which is a dependency of astropy and can be imported directly using "import erfa" [astropy._erfa]
Traceback (most recent call last):
File ".\planetSim.py", line 3, in <module>
molniya.plot()
File "C:\Users\####\AppData\Local\Programs\Python\Python38\lib\site-packages\poliastro\twobody\orbit.py", line 1435, in plot
return StaticOrbitPlotter().plot(self, label=label)
File "C:\Users\####\AppData\Local\Programs\Python\Python38\lib\site-packages\poliastro\plotting\static.py", line 215, in plot
lines = self._plot(orbit, label=label, color=color, trail=trail)
File "C:\Users\####\AppData\Local\Programs\Python\Python38\lib\site-packages\poliastro\plotting\_base.py", line 153, in _plot
label = generate_label(orbit.epoch, label)
File "C:\Users\####\AppData\Local\Programs\Python\Python38\lib\site-packages\poliastro\plotting\util.py", line 20, in generate_label
epoch.out_subfmt = "date_hm"
File "C:\Users\####\AppData\Local\Programs\Python\Python38\lib\site-packages\astropy\time\core.py", line 622, in out_subfmt
self._time.out_subfmt = val
File "C:\Users\####\AppData\Local\Programs\Python\Python38\lib\site-packages\astropy\time\formats.py", line 183, in out_subfmt
self._select_subfmts(subfmt)
File "C:\Users\####\AppData\Local\Programs\Python\Python38\lib\site-packages\astropy\time\formats.py", line 396, in _select_subfmts
raise ValueError(f'subformat not allowed for format {cls.name}')
ValueError: subformat not allowed for format jyear_str
(I replaced my Username with ####)
(I dont use conda for this project)
pip freeze:
# Paste your output here:
`astropy==4.2
astroquery==0.4.1
beautifulsoup4==4.9.3
certifi==2020.12.5
chardet==4.0.0
cycler==0.10.0
html5lib==1.1
idna==2.10
jplephem==2.15
keyring==22.0.0
kiwisolver==1.3.1
llvmlite==0.35.0
matplotlib==3.3.3
numba==0.52.0
numpy==1.19.5
pandas==1.2.1
Pillow==8.1.0
plotly==4.14.3
poliastro==0.14.0
pyerfa==1.7.1.1
pyparsing==2.4.7
python-dateutil==2.8.1
pytz==2020.5
pywin32-ctypes==0.2.0
requests==2.25.1
retrying==1.3.3
scipy==1.6.0
six==1.15.0
soupsieve==2.1
urllib3==1.26.2
webencodings==0.5.1`
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (10 by maintainers)
Top Results From Across the Web
Cannot access mjd property on Time with out_subfmt set to date
Obviously, the problem is that out_subfmt makes sense for iso , for which you created the instance, but not for format='mjd' , which...
Read more >Time and Dates (astropy.time) — Astropy v5.2
ValueError : Input values did not match the format class byear: ValueError: Cannot use Quantities for 'byear' format, as the interpretation would be...
Read more >Time and Dates (astropy.time) - The University of Texas at Austin
The supported subformats are date_hms, date_hm, and date. ... ValueError: Input values did not match any of the formats where the format keyword...
Read more >Time and Dates (astropy.time) — Astropy v3.2.dev994
The supported subformats are date_hms , date_hm , and date for all but the TimeFITS format; the latter does not support date_hm but...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks! Downgrading to 4.0 fixed it.
Thanks for yesterday’s help @DhruvSondhi and @Yash-10. It seems that if poliastro is imported first, then astropy version 4.0 is imported, otherwise astropy 4.2 is imported and it is necessesary to reset the virtualenv.