Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7851775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:15:45+00:00 2026-06-02T19:15:45+00:00

I do have the following path in the memory: video_path = u’C:\\Documents and Settings\\user\\My

  • 0

I do have the following path in the memory:

video_path = u'C:\\Documents and Settings\\user\\My Documents\\Downloads\\\xf5iv - Neon Phoenix [Free DL].mp3'

I’m trying to use it as a parameter in cmd, so I have to encode it.

video_path = video_path.encode(sys.getfilesystemencoding())
cmd = 'ffmpeg -y -i "%s" -vn -ac 2 -f mp3 audio.mp3' % video_path
subprocess.Popen(cmd)

However the string is not encoded in the right way – it converts the \xf5 to ? instead of õ. Therefore the file could not be found.

How can this happen? I’m using the default filesystem encoding (which is mbcs).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:15:46+00:00Added an answer on June 2, 2026 at 7:15 pm

    From an answer here:

    In Py3K – at least from “Python” 3.2 – subprocess.Popen and sys.argv
    work consistently with (default unicode) str’s on Windows.
    CreateProcessW and GetCommandLineW are used obviously.

    In Python – up to v2.7.2 at least – subprocess.Popen is buggy with
    unicode arguments. It sticks to CreateProcessA (while os.* are
    consistent with unicode). And shlex.split creates additional nonsense.
    Pywin32’s win32process.CreateProcess also doesn’t auto-switch to the W
    version, nor is there a win32process.CreateProcessW. Same with
    GetCommandLine. Thus ctypes.windll.kernel32.CreateProcessW… needs to
    be used. The subprocess module perhaps should be fixed regarding this
    issue.

    Therefore, subprocess.Popen can’t handle unicode right at Python 2.x versions.

    My solution was renaming the input file to something random (with os.rename, which supports unicode), convert with ffmpeg that i launch with subprocess.Popen, and then rename it back.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following settings URL urlpatterns = patterns('', (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_DOC_ROOT}), url(r'^index/$','pMass.views.index', name='index'),
I have images placed in following path res>drawable>Images>Currencies>[All images] I have made a custom
I have following code: os.chdir(os.path.dirname(os.path.realpath(__file__)) + /../test) path.append(os.getcwd()) os.chdir(os.path.dirname(os.path.realpath(__file__))) Which should add /../test to
I have the following code $env=array('PATH'=>'C:\Program Files\MySQL\MySQL Server 5.1\bin', 'PATHEXT' => '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC'); $cmd='mysql --port=3306
I have lots of bson files in the following path: c:/mongodb/bin/dump/Sid If I run
I have a class which loads an xml file using the following: Path.Combine( AppDomain.CurrentDomain.BaseDirectory,
I was already running a sub-website under following path http://example.com/sub-site/ Now, I have created
I have the following code: f = open(path, 'r') html = f.read() # no
I have the following code in specman: var x := some.very.long.path.to.a.variable.in.another.struct; while (x ==
I have the following code to launch a file : try { path =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.