jorgebooks / measureit

Automatically exported from code.google.com/p/measureit
0 stars 0 forks source link

Patch for /trunk/measureit_system_files/python/data-input.py #51

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Had a issue on a Linux box where is was trying to access C:\measureit.log, 
moving this to a else statement solved the issue

Traceback (most recent call last):
  File "/usr/local/measureit/python/data-input.py", line 29, in <module>
    hdlr = logging.FileHandler('C:\measureit.log')
  File "/usr/lib/python2.7/logging/__init__.py", line 901, in __init__
    StreamHandler.__init__(self, self._open())
  File "/usr/lib/python2.7/logging/__init__.py", line 924, in _open
    stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/etc/measureit/C:\\measureit.log'

Original issue reported on code.google.com by andrewtr...@live.co.uk on 15 Jan 2014 at 8:48

Attachments:

GoogleCodeExporter commented 9 years ago
What kind of "linux box" you are using?

Can you do a print platform.system() to see what the system is?

Original comment by lalelu...@gmail.com on 18 Jan 2014 at 12:27

GoogleCodeExporter commented 9 years ago
Rasperry Pi NOOBS Raspbian

>>> platform.system()
'Linux'
>>> platform.platform()
'Linux-3.10.25+-armv6l-with-debian-7.2'

Original comment by andrewtr...@live.co.uk on 19 Jan 2014 at 12:13

GoogleCodeExporter commented 9 years ago
I solved it with a regular search so that any system that use Linux in the name 
will match

Thank you for your help.

r = re.search(r"Linux", platform.system())
if r:
    usbport = '/dev/ttyUSB0'
    config_file_name = "/usr/local/measureit/measureit.cfg.php"
    hdlr = logging.FileHandler('/tmp/measureit.log')
    #clear logfile
    subprocess.call('echo "" > /tmp/measureit.log', shell=True

Original comment by lalelu...@gmail.com on 2 Feb 2014 at 9:59

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Solved in version 116 that is available to download

Original comment by lalelu...@gmail.com on 19 Apr 2014 at 9:10