Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Send data from FiPy to server

    Scheduled Pinned Locked Moved FiPy
    mysqlservermicropythonfipy
    3 Posts 2 Posters 1.0k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N Offline
      Nazz
      last edited by

      Hello Team,

      I am trying to send sensor data from FiPy to server. (Ex. i am using my local computer as server with MySQL as DB). Am running below code in atom but getting ImportError No module named MySQLdb.

      #!/usr/bin/python
      import MySQLdb
      #Setting up connection
      db = MySQLdb.connect(host=" ", # your host
      user=" ", # username
      passwd=" ", # password
      db=" ") # fill with dredentials

      cursor = db.cursor()
      sql = "INSERT INTO EMPLOYEE(FIRST_NAME,
      LAST_NAME, AGE, SEX, INCOME)
      VALUES ('%s', '%s', '%d', '%c', '%d' )"

      try:
      cursor.execute(sql)
      db.commit() #// SAVE PERMANENTLY
      except:
      db.rollback() #// IF U GOT ERROR ROLL BACK ALL UR CHANGES
      db.close()

      Please help me with this. How to send data from FiPy to server, if anyone can share code for the same it would be great help.

      Waiting for you valuable responses , kindly reply as soon as possible.

      Thank You

      L 1 Reply Last reply Reply Quote 0
      • L Offline
        livius @Nazz
        last edited by

        @nazz
        You cannot use mysql directly - create some service on your computer and connect your Fipy to it
        https://forum.pycom.io/topic/813/mysql

        think about people first, then computers

        N 1 Reply Last reply Reply Quote 0
        • N Offline
          Nazz @livius
          last edited by

          @livius
          Hello,

          Thank you very much for your quick response, as am new to server and pycom, it would be great help if you could share the code from fipy side and server side with step by step procedure.

          Thank You

          1 Reply Last reply Reply Quote 0

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better 💗

          Register Login
          • 1 / 1
          • First post
            Last post

          Pycom on Twitter

          Pycom