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 6670867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:19:10+00:00 2026-05-26T03:19:10+00:00

Under winxp (pro x64 version 2003, sp2), running the following at cmd prompt works

  • 0

Under winxp (pro x64 version 2003, sp2), running the following at cmd prompt works fine:

dir C:\testüüüdirectory\

Please note the ‘ü’ character.

But from python 2.7.1.4, the following always returns an error code 1:

>>> res = os.popen("dir C:\\testüüüdirectory\\")
>>> res.close()
1
>>>

How can i get popen to accept the ü character?

  • 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-05-26T03:19:11+00:00Added an answer on May 26, 2026 at 3:19 am

    This would probably be an encoding issue, where your input doesn’t quite match what the file system expects on output. First, you’ll need to tell Python what encoding your input uses, then what encoding the popen() call expects.

    >>> filename = "C:\\testüüüdirectory\\".decode("utf-8")
    >>> res = os.popen("dir " + filename.encode("cp1252"))
    

    You may have to experiment with various encoding combinations to get the right pair. UTF-8, UTF-16, and cp1252 are the most likely candidates for Windows, but your system might be set up to use another encoding. If you’re really lucky, os.popen() might even accept a Unicode string, in which case the encode() step could be skipped.

    If you’re really unlucky, character canonicalization could be an issue. There are two possible representations of “ü” in Unicode: U+00FC or U+0075 U+0308; the second is a “u” with a combining diaresis, while the first is pre-combined. If Windows expects one while encode() produces the other, you may have to work a bit to get the right string.

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

Sidebar

Related Questions

I cannot os.chdir(path) in Python 2.6.5 under WindowsXP SP2. It works fine under CygWin
I have a Windows service (under WinXP SP2), running under the LocalSystem account, that
Running PHP under IIS on my Win XP Pro system. I cannot debug my
Our application (C# .Net 3.5) works fine on WinXP machines (embedded or not). Now
I have built a .dll under WinXP that claims it can't find DWMAPI.DLL when
I have created a native application. It works without questions under Win XP and
Pythons installed under WinXP have dirs like DLLs, DOC, include, etc. but python (2.5)
I developed a WPF application under WinXP and my ListView had my expected layout.
I have a windows service application, running under WinXPe, which sometimes fails with an
I have tried to create a custom-painted icon using QT under window. The following

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.