Magic Lantern Forum

Developing Magic Lantern => Modules Development => Module writing Q&A => Topic started by: Greg on September 10, 2013, 08:33:17 PM

Title: Creating a new module problem
Post by: Greg on September 10, 2013, 08:33:17 PM
What's the problem?

Compile error:
[ README   ]   module_strings.h
Traceback (most recent call last):
  File "../readme2modulestrings.py", line 108, in <module>
    seconds = float(split[0]) + float(split[1])
ValueError: could not convert string to float:

Title: Re: Creating a new module problem
Post by: dmilligan on September 10, 2013, 10:48:34 PM
could be a problem with the version of python you are running
Title: Re: Creating a new module problem
Post by: Greg on September 10, 2013, 11:12:40 PM
Quote from: dmilligan on September 10, 2013, 10:48:34 PM
could be a problem with the version of python you are running

I have Python 2.7.1+
Title: Re: Creating a new module problem
Post by: a1ex on September 10, 2013, 11:14:54 PM
What's in the "split" variable? (print it)
Title: Re: Creating a new module problem
Post by: Greg on September 11, 2013, 12:32:33 AM
My fix :

readme2modulestrings.py
- seconds = float(split[0]) + float(split[1])
- last_change_date = datetime.utcfromtimestamp(seconds).strftime("%Y-%m-%d %H:%M:%S UTC")


Now work  ;)

Title: Re: Creating a new module problem
Post by: Pelican on September 11, 2013, 01:08:48 AM
last_change_date = run("LC_TIME=EN hg log . -l 1 --template '{date|hgdate}'")
split = last_change_date.split(" ")
seconds = float(split[0]) + float(split[1])
last_change_date = datetime.utcfromtimestamp(seconds).strftime("%Y-%m-%d %H:%M:%S UTC")

I guess the new module not in the hg repo so you cannot get log info from there so the split is empty.
Title: Re: Creating a new module problem
Post by: Greg on September 11, 2013, 03:21:11 AM
greg@ubuntu:~/magic-lantern-sensor-cleaning$ hg commit -m "Sensor cleaning module"
nothing changed
:-\

How to add a new module to the bitbucket?
Title: Re: Creating a new module problem
Post by: dmilligan on September 11, 2013, 04:19:05 AM
hg commit only commits to your local repo, you then need to push that commit to the remote bitbucket repo with hg push
Title: Re: Creating a new module problem
Post by: Greg on September 11, 2013, 04:24:51 AM
Yes, but to do hg push you need to do before hg commit. It does not work for new files.
Title: Re: Creating a new module problem
Post by: Audionut on September 11, 2013, 04:29:44 AM
Try hg update first.
Title: Re: Creating a new module problem
Post by: 1% on September 11, 2013, 05:10:40 AM
also hg add
Title: Re: Creating a new module problem
Post by: Greg on September 11, 2013, 01:51:04 PM
Quote from: 1% on September 11, 2013, 05:10:40 AM
also hg add

It works, thanks.