Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Set QML_XHR_ALLOW_FILE_READ in python
Forum Updated to NodeBB v4.3 + New Features

Set QML_XHR_ALLOW_FILE_READ in python

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 1.3k Views
  • 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.
  • D Offline
    D Offline
    Developer123
    wrote on last edited by
    #1

    I want to read a local file directly using QML. But I'm getting this warning/error:

    XMLHttpRequest: Using GET on a local file is dangerous and will be disabled by default in a future Qt version.Set QML_XHR_ALLOW_FILE_READ to 1 if you wish to continue using this feature.

    Here is says I should use the qputenv() to set the environment variable.

    https://www.reddit.com/r/QtFramework/comments/mh9oqi/local_files_with_qml/

    However this is for C++, how would that be done in python (PySide2)? I couldn't fine an equivalent function from PySide2

    1 Reply Last reply
    0
    • GrecKoG Offline
      GrecKoG Offline
      GrecKo
      Qt Champions 2018
      wrote on last edited by
      #2

      os.environ["QML_XHR_ALLOW_FILE_READ"] = "1" should work I guess : https://docs.python.org/3/library/os.html#os.environ

      1 Reply Last reply
      3

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved