Skip to content

Minor issues#2

Open
castilma wants to merge 1 commit into
Hiverize:masterfrom
castilma:minor_issues
Open

Minor issues#2
castilma wants to merge 1 commit into
Hiverize:masterfrom
castilma:minor_issues

Conversation

@castilma
Copy link
Copy Markdown

I found some minor things. See the review for details.

Copy link
Copy Markdown
Author

@castilma castilma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are unhappy with some changes, or want more, tell me.

Comment thread temperatureHumidity.py

for i in range(1, 3):
tries = 2
for i in range(1, tries + 1):
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment in line 31 says read_retry() is being used, but read() is used. And we're only trying 2 times.

Comment thread temperatureHumidity.py
if humidity is not None and temperatureDHT is not None:
return humidity, temperatureDHT
sleep(2)
print('{}. DHT Measurement failed. Starting next try'.format(i))
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prints [...] Starting next try even after the last try.

Comment thread temperatureHumidity.py
if i != tries else ''))
except ValueError:
print('Sensor not found')
break
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When there is no sensor, there is no reason to retry, right?

Comment thread temperatureHumidity.py
# Note that sometimes you won't get a reading and
# the results will be null (because Linux can't
# guarantee the timing of calls to read the sensor).
# If this happens try again!
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a copy of lines 36-39.

Comment thread temperatureHumidity.py
print('Error creating folder: ' + str(e) ) # errno 17= File existed
else:
pass
print('Folder created')
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only print the message if makedirs() succeded. Otherwise we didn't create the folder.

Comment thread temperatureHumidity.py
@@ -137,16 +135,16 @@ def logging():
print(folderName)
try:
os.makedirs(folderName, mode=0o777)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really mode 0o777? How about at most 0o775?

Comment thread temperatureHumidity.py
if e.errno != 17:
print('Error creating folder: ' + str(e) ) # errno 17= File existed
else:
pass
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is a good situation to abort? But maybe not. I don't know.

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

Successfully merging this pull request may close these issues.

1 participant