WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   EXE file is unable to update/create CSV file (https://forum.worldviz.com/showthread.php?t=6442)

anup.roy@iitgn. 06-05-2024 10:42 PM

EXE file is unable to update/create CSV file
 
Hi

We have developed Vizard based code (on Vizard 7), which creates and updates CSV file. On the Vizard IDE the code is working fine and is able to modify CSV.

However, when same code is exported as EXE using "Export as EXE" option on Vizard, it is unable to create/modify the CSV file.

We have checked permissions:
  1. The CSV file is not read-only.
  2. The User has Full Control (Read+Write+Execute) on Windows 10.
  3. The directory inside of which both EXE and CSV are present, is not read-only.


Below is the file handling code we are using. Please provide your valuable response.

Code:

try:
  # Save the demographic information to a CSV file (assuming "data" folder exists)
  with open('data/demographic_info.csv', 'a', newline='') as csvfile:
    fieldnames = ['name', 'age', 'gender', 'handedness']
    writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
    writer.writeheader()  # Write header if file is empty
    demographics['gender'] = ['Male', 'Female', 'Other'][demographics['gender'] - 1]
    demographics['handedness'] = ['Left Handed', 'Right Handed'][demographics['handedness'] - 1]
    writer.writerow(demographics)
    text = viz.addText3D(f"Success", parent=viz.SCREEN)
    # ... (rest of success message)
except Exception as e:
  print(f"Error writing to CSV: {e}")  # Print the specific error
  text = viz.addText3D(f"Error: Writing to CSV", parent=viz.SCREEN)



All times are GMT -7. The time now is 10:58 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC