Giter Site home page Giter Site logo

Comments (2)

adamcatto avatar adamcatto commented on July 16, 2024

I had the same issue and for some reason it didn't go away when I removed the forward slash part; however, I've written a pretty straightforward Python function to automatically modify the full path into an equivalent relative path. You just need to write the proper path to the cwa-convert build in CWA_CONVERT_CMD_PATH:

import os
import subprocess


# note: first, openmovement git repo has to be cloned, then the C library must be built.

CWA_CONVERT_CMD_PATH = '/path/to/openmovement/Software/AX3/cwa-convert/c/cwa-convert'
# note: C code has a bug where it can't read an argument starting with '/' as a file
#       so we need to specify the number of "../" prefixes to put...

def convert_cwa_to_csv(input_filename, output_filename):
    # make sure that we have gotten full path to input_file
    if input_filename[0] != '/':
        # TODO{try to handle non-full-paths by using glob.iglob and inferring the proper path.}
        raise Exception('Must specify full path. i.e. /path/to/file.ext')
    filename = input_filename.split('/')[-1]
    pwd = os.getcwd()
    num_directory_levels_up_to_go = len(pwd.split('/')) - 2
    input_dir_prefix = '../' * num_directory_levels_up_to_go
    full_input_path = input_dir_prefix + filename

    subprocess.run([CWA_CONVERT_CMD_PATH, full_input_path, '-out', output_filename])

from openmovement.

danielgjackson avatar danielgjackson commented on July 16, 2024

Sorry this took so long to fix. Thanks for the original report @NarayanSchuetz and recent comment @adamcatto that notified me that this was still an issue. Fixed in a82452f

from openmovement.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.