Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

457
Views
Unable To open True Type (TTF) font file in Python 3

I'm running Laravel project on Nginx server, in which I call a python file using below command by passing arguments

$result = exec("python3 path/to/file.py $data");

In the python file, there is a line of code

    font_file = base_path+'/fonts/LiberationMono-Bold.ttf'
    cmd = ["ttf2cxf_stream",
                   "",
                   "-s","5.0",
                   font_file,"STDOUT"]
    p = Popen(cmd, stdout=PIPE, stderr=PIPE)

This is giving an error that it can't open the font file which is present on that location. The owner of the project is ubuntu:www-data and the font file is present in that project. I also tried giving it 777 permission but still no luck.

Now when I run the same command in terminal

python3 path/to/file.py "data"

It successfully runs without the font file access error. What could be the issue?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I had faced similar issue while using "ttf2cxf_stream" library to open font - ttf files. Please check if ttf2cxf_stream exist in /usr/bin directory if not then try copying it from /usr/local/bin/ directory and see if you can run py file through PHP code.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!