hpparvi / ldtk

Python toolkit for calculating stellar limb darkening profiles and model-specific coefficients using the stellar atmosphere spectrum library by Husser et al. (2013). Described in Parviainen & Aigrain, MNRAS 453, 3821–3826 (2015).
GNU General Public License v2.0
29 stars 19 forks source link

EORError: Python 3.5 compatibility? #10

Closed lisadang27 closed 6 years ago

lisadang27 commented 7 years ago

Hi,

First of all, thank you for this limb-darkening coefficient prior calculator tool!

I am currently using Python 3.6 and I have run into what seems to be a compatibility problem. I tried running the example given here: https://github.com/hpparvi/ldtk But ran into the following error which I have not yet been able to resolve:


EOFError Traceback (most recent call last)

in () 8 logg=(4.50, 0.20), # downloads the uncached stellar 9 z=(0.25, 0.05), # spectra from the Husser et al. ---> 10 filters=filters) # FTP server automatically. 11 12 ps = sc.create_profiles() # Create the limb darkening profiles /Users/ldang/anaconda/envs/python3/lib/python3.6/site-packages/ldtk/ldtk.py in __init__(self, teff, logg, z, filters, qe, limits, offline_mode, force_download, verbose, cache) 297 print("Fe/H limits: " + str(metal_lims)) 298 --> 299 self.client = c = Client(limits=[teff_lims, logg_lims, metal_lims], cache=cache) 300 self.files = self.client.local_filenames 301 self.filters = filters /Users/ldang/anaconda/envs/python3/lib/python3.6/site-packages/ldtk/client.py in __init__(self, limits, verbosity, offline_mode, update_server_file_list, cache) 38 os.mkdir(self._cache) 39 ---> 40 if exists(self._server_file_list) and not update_server_file_list: 41 with open(self._server_file_list, 'rb') as fin: 42 self.files_in_server = load(fin) EOFError: Ran out of input

Any idea? Thank you!

hpparvi commented 7 years ago

Hi,

Sorry, I can't reproduce this. Can you tell what OS you're using? Also, could you try deleting the server file list ($HOME/.ldtk/server_file_list.pkl if you haven't set the LDTK_ROOT or cache directory separately), since it might be that the file is corrupted for some reason.

Cheers, Hannu

reamonnk commented 7 years ago

I've a similar issue where it seems to have an issue with the server file. I'm running the sample script given on the Github page. I am currently on Python 3.6.1 64 bit. Originally the code did not work so I changed a single line in the code from os.getenv('HOME') to os.getenv('USERPROFILE') as HOME was not recognized as a valid keyword. This change created C:\Users\Reamonn.ldtk as it should have. It should be noted that when I run print(os.getenv('LDTK_ROOT')) in a notebook, it returns a value of none. Should LDTK_ROOT point to a specific directory later in the code?

I am operating on windows 8.1 64 bit.I have tried to delete the server_file_list.pkl and rerunning the code. The file is located in: C:\Users\Reamonn.ldtk, but it seems to have a file size of 0KB and be empty when I try to open in in notepad++. Any help would be appreciated in this. Regards Reamonn


TypeError Traceback (most recent call last)

in () 8 logg=(4.50, 0.20), # downloads the uncached stellar 9 z=(0.25, 0.05), # spectra from the Husser et al. ---> 10 filters=filters) # FTP server automatically. 11 12 ps = sc.create_profiles() # Create the limb darkening profiles C:\Users\Reamonn\Anaconda3\lib\site-packages\ldtk\ldtk.py in __init__(self, teff, logg, z, filters, qe, limits, offline_mode, force_download, verbose, cache) 297 print("Fe/H limits: " + str(metal_lims)) 298 --> 299 self.client = c = Client(limits=[teff_lims, logg_lims, metal_lims], cache=cache) 300 self.files = self.client.local_filenames 301 self.filters = filters C:\Users\Reamonn\Anaconda3\lib\site-packages\ldtk\client.py in __init__(self, limits, verbosity, offline_mode, update_server_file_list, cache) 42 self.files_in_server = self.get_server_file_list() 43 with open(self._server_file_list, 'w') as fout: ---> 44 dump(self.files_in_server, fout) 45 46 if limits: TypeError: write() argument must be str, not bytes
hpparvi commented 7 years ago

Hi,

Unfortunately I don't have access to a Windows machine. You can set LDTK_ROOT to point to a directory you want to use as the root directory for LDTk, and it will override the default $HOME/.ldtk, but it doesn't need to be set if the default directory is ok.

I'll need to add some compatibility code for LDTk to work in Windows, and will add $USERPROFILE/.ldtk as the default root directory for Windows (unless there are more appropriate directories?). I'll be also very happy to include any solutions you may find. I haven't used Windows much since Win95/98, so I can be of little help...