Differences between revisions 81 and 141 (spanning 60 versions)
Revision 81 as of 2007-09-09 06:52:16
Size: 6264
Editor: c-69-252-155-205
Comment:
Revision 141 as of 2015-01-10 21:29:08
Size: 22391
Comment: corrected intrapage link
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Asking for Help =

The most efficient way of getting help is via the [[MailingListsAndNewsgroups|various mailing lists and newsgroups]], particularly [[CompLangPython|the comp.lang.python]] newsgroup.

See the [[Community|Community]] page for a selection of related resources.

For those of you willing to wait, and to add to the archive of problems (and solutions), enter your question in the list below. For longer questions, consider adding a new page using the button just below: write a short version of the question in the box - this will be the page name - and then write the actual question or problem description in the page editor that appears after pressing the button.

The page will be automatically added to the [[Asking for Help#Longer Questions|longer questions]] section below.

== Questions ==

 * ssl-1.14.tar.gz exists and supposedly works with Python 2.5x. Assuming I have Visual Studio .NET 2003 available on my box, how do I build the package for Windows. It currently complains about a series of openssl *.h files that aren't available. I can drag in openssl for www.openssl.org, but which version, if that is applicable, and how do I connect the two either in a directory structure or appropriate configuration files?

 * I'm working with embedding Python into my applications. However, the Py_Initialize() is producing an " 'import site' failed " message on non-dev computers. I was wondering if there is a way to fix this or is it just a bug with Python? Thank you.

 * I'm trying to run the IDLE but it wont go on. i have an R52 leptop with ibm-tools installed (there is ver 2.2 there but i changed it so it wont ebe the default one). im trying to run ver 2.6. Thank

 * I'm new to python and I am just working with the idle-shell. How can I write a script without having python executing orders immediately after I type them into the shell? Follow-Up question: Having written the script, how do I run it in the interpreter?
 * I just installed [[MacPython|MacPython]]. Unfortunately it doesn't seem to include the [[CoreGraphics|CoreGraphics]]-Python Module. Where ist my old system python? How can I uninstall [[MacPython|MacPython]]?

 * Is there any way to get the environment from a subprocess.Popen created by python? In other words, if the new process updates it's environment, is it possible to get access to the modifications. For example In my case I'm executing MS Visual Studio's vsvars32.bat file and would like to access the modified PATH environment variable.
Line 4: Line 27:
 *["How to store information in variable arrays?"]  * [[Why do I call constructor of Cmd class in my Cmd subclass __init__ method?|Why do I call constructor of Cmd class in my Cmd subclass __init__ method?]]
 * [[When I import Tkinter, Python exits. Why?|When I import Tkinter, Python exits. Why?]]
Line 6: Line 30:
 *["How to use Python with MySQL on Windows"]  * I am new at python, I have python 2.5 and every time i open the shell python resets my moniter to 800x600. How do I keep python from messing with my monitor settings? -Travis
Line 8: Line 32:
 *["How to have a mutable buffer with python 2.3?"]
Line 10: Line 33:
 *["Why do I get permission denied errors when using macostools.copy"] == Longer Questions ==
Line 12: Line 35:
 *["When I import Tkinter, Python exits. Why?"] Pages containing longer questions should appear in this list:

 1. [[Asking for Help/How delete files in the GUI|Asking for Help/How delete files in the GUI]]
 1. [[Asking for Help/How do you create tables in Python?|Asking for Help/How do you create tables in Python?]]
 1. [[Asking for Help/How to solve problem when running python from command line?|Asking for Help/How to solve problem when running python from command line?]]
 1. [[Asking for Help/How to use Python with MySQL on Windows|Asking for Help/How to use Python with MySQL on Windows]]
 1. [[Asking for Help/How to use Reg. Exp. to capture data from random text|Asking for Help/How to use Reg. Exp. to capture data from random text]]
 1. [[Asking for Help/How to utilize SQL Server stored procedure that accepts table valued parameter|Asking for Help/How to utilize SQL Server stored procedure that accepts table valued parameter]]
 1. [[Asking for Help/I am trying to run Python on IDLE in Windows. Why doesn't IDLE close old pythonw processes on restarting the shell or even quitting IDLE?|Asking for Help/I am trying to run Python on IDLE in Windows. Why doesn't IDLE close old pythonw processes on restarting the shell or even quitting IDLE?]]
 1. [[Asking for Help/I don't see a 'run' option in the toolbar of Python 3|Asking for Help/I don't see a 'run' option in the toolbar of Python 3]]
 1. [[Asking for Help/I tried to port python 2.7 to iOS and got "Fatal Python error: exceptions bootstrapping error.". How can I fix it?|Asking for Help/I tried to port python 2.7 to iOS and got "Fatal Python error: exceptions bootstrapping error.". How can I fix it?]]
 1. [[Asking for Help/I want to right-click on data files in Windows XP and open them with a Python program.|Asking for Help/I want to right-click on data files in Windows XP and open them with a Python program.]]
 1. [[Asking for Help/Installation Errors|Asking for Help/Installation Errors]]
 1. [[Asking for Help/Is there a way to use i instead of j for complex numbers?|Asking for Help/Is there a way to use i instead of j for complex numbers?]]
 1. [[Asking for Help/Python ISO-8859-1 encoding problem|Asking for Help/Python ISO-8859-1 encoding problem]]
 1. [[Asking for Help/Python,Pydev and the terminal in linux.|Asking for Help/Python,Pydev and the terminal in linux.]]
 1. [[Asking for Help/Using Python with native DB2 drivers|Asking for Help/Using Python with native DB2 drivers]]
 1. [[Asking for Help/What is wrong with this "game of life" program?|Asking for Help/What is wrong with this "game of life" program?]]
 1. [[Asking for Help/What's the simplest way to connect to a MSSQL database via Python v3? I'm trying sqlite3, but I think I'm barking up the wrong tree...|Asking for Help/What's the simplest way to connect to a MSSQL database via Python v3? I'm trying sqlite3, but I think I'm barking up the wrong tree...]]
 1. [[Asking for Help/Why do I get permission denied errors when using macostools.copy?|Asking for Help/Why do I get permission denied errors when using macostools.copy?]]
 1. [[Asking for Help/Why do I see b'string' when i print a c_char_p string?|Asking for Help/Why do I see b'string' when i print a c_char_p string?]]
 1. [[Asking for Help/does a python blink|Asking for Help/does a python blink]]
 1. [[Asking for Help/exiting idle|Asking for Help/exiting idle]]
 1. [[Asking for Help/remove escape characters|Asking for Help/remove escape characters]]
 1. [[Asking for Help/remove write protected file forcefully like "rm -f"|Asking for Help/remove write protected file forcefully like "rm -f"]]
 1. [[Asking for Help/thread started using 'bg' ends without any notification|Asking for Help/thread started using 'bg' ends without any notification]]
 1. [[Asking for Help/with newton force calculator|Asking for Help/with newton force calculator]]




These questions will be moved to the [[Asking for Help#AnsweredLongerQuestions|answered longer questions section]] below when they are answered (having been added to the [[CategoryAskingForHelpAnswered|CategoryAskingForHelpAnswered]] category).
Line 15: Line 70:
 *[:MultiLineStringsInDocTest:How do I write multi-line strings in doctest tests?]
Line 17: Line 71:
 *["How do I get / set the modification date of a file?"]
Line 19: Line 72:
 *["How do I use gzip module with pickle?"]  * [[MultiLineStringsInDocTest|How do I write multi-line strings in doctest tests?]]
 * Related question to the for-a-blink question in the answered section. When running os.system(some command) the CMD.exe window pops up and then terminates when the process terminates. [[How do I get the contents of what was in that CMD.exe window saved someplace - variable, file, etc.|How do I get the contents of what was in that CMD.exe window saved someplace - variable, file, etc.]] Variable assignment doesn't work - only the exit code is in the variable.
  . Seems to me you need to redirect the stdout. As per Python Library Reference 6.1.5., this is impossible for os.system() calls.
Line 21: Line 76:
 *["How can "normal" users report bugs in Python or the documentation?"]
Line 23: Line 77:
 *["How can I convert a hex representation to an integer?"]  * Does anyone know why msOffice products (using win32com return) u'dana\u2019s best' rather than u'dana's best'?
  .
  Microsoft Office replaces apostrophes (U+0027) with "Right Single Quotation Marks" (U+2019) automatically. While this looks correct typograpphically, it might cause some problems. -- [[IanBollinger|IanBollinger]]
Line 25: Line 81:
 *SubtractionQuestion
Line 27: Line 82:
 * Related question to the for-a-blink question in the answered section. When running os.system(some command) the CMD.exe window pops up and then terminates when the process terminates. ["How do I get the contents of what was in that CMD.exe window saved someplace - variable, file, etc."] Variable assignment doesn't work - only the exit code is in the variable.
  Seems to me you need to redirect the stdout. As per Python Library Reference 6.1.5., this is impossible for os.system() calls.
 * I'm a total Python newbie. How do I get Python started on a Palm handheld ( http://c2.com/cgi/wiki?PalmPython ) ? Or should I focus on learning Python on a desktop PC first ? -- [[DavidCary|DavidCary]]
  .
  I would recommend learning Python on a normal desktop system, with a recent version, a full suite of libraries, and [[http://ipython.scipy.org/|IPython]] (Interactive Python) installed. After you've learned the basics then you can probably adapt more readily to the limitations of the Palm Pilot interface, implementation, version (older), and libraries (reduced subset). [[JimD|JimD]]
Line 30: Line 86:
 *Does anyone know why msOffice products (using win32com return) u'dana\u2019s best' rather than u'dana's best'?
  Microsoft Office replaces apostrophes (U+0027) with "Right Single Quotation Marks" (U+2019) automatically. While this looks correct typograpphically, it might cause some problems. -- IanBollinger
Line 33: Line 87:
 *I'm a total Python newbie. How do I get Python started on a Palm handheld ( http://c2.com/cgi/wiki?PalmPython ) ? Or should I focus on learning Python on a desktop PC first ? -- DavidCary
  I would recommend learning Python on a normal desktop system, with a recent version, a full suite of libraries, and [http://ipython.scipy.org/ IPython] (Interactive Python) installed. After you've learned the basics then you can probably adapt more readily to the limitations of the Palm Pilot interface, implementation, version (older), and libraries (reduced subset). ["JimD"]
Line 37: Line 89:
  Save it as "scriptName.py" and then execute it with the Python interpreter. As for choosing a purpose for the code, that's entirely up to you. -- PeytonMcCullough
   How do I save it as scriptname.py? --elpenmaster
    - it is possible to enter python commands into a text file, rather than entering them directly into the python shell. Simply create a text file containing your python instructions and save it as scriptname.py, you can then import it into a python shell session or execute it directly.
 *TestHarnessDesign -- I've been assigned the task of designing a test harness for embedded systems, servers and software. -- ["JimD"]
  .
  Save it as "scriptName.py" and then execute it with the Python interpreter. As for choosing a purpose for the code, that's entirely up to you. -- [[PeytonMcCullough|PeytonMcCullough]]
Line 42: Line 92:
 *How do I publish Python modules?
  See PublishingPythonModules - ["Philip"], 2005-09-19
   . How do I save it as scriptname.py? --elpenmaster
    . - it is possible to enter python commands into a text file, rather than entering them directly into the python shell. Simply create a text file containing your python instructions and save it as scriptname.py, you can then import it into a python shell session or execute it directly.
Line 45: Line 95:
  ["lwickjr"]: My question, "my" page. I created that page, empty, in hopes that someone would populate it. They have, and I've read it. They hadn`t yet when I created *this* page for posting how-to questions, at about the same time, so I included the question here in the seed page. See the attachments to [:lwickjr: my page] for my final solution to the problem. ;) By the way, "How to publish Python modules" has been renamed "PublishingPythonModules", to be more Wiki-style. [Me, again.] 2005-11-24.
Line 47: Line 96:
 *i got winxp. i make a simple program like print "hello". i save it as whatever.py. then i double-click it. nothing happens just the windows cmd appears for a blink. Additionally you can go to Start -> Run, type 'cmd', and hit enter. Now cd to your foo.py file, and execute it.
Line 49: Line 97:
  The Windows command window appears "for a blink" to show the output ("hello") before going away again - your program ends and the window closes. You can, of course, run the program from the command window (type "python whatever.py") to see the output, or you could make the program pause (using time.sleep) or wait for input (raw_input) before finishing - that would at least leave the command window open. Some operating systems leave command windows open after the program has finished, by the way.  * [[TestHarnessDesign|TestHarnessDesign]] -- I've been assigned the task of designing a test harness for embedded systems, servers and software. -- [[JimD|JimD]]
Line 51: Line 99:
 * This is an actual question. I have have a prototype for a python related website. Right now I am just running it off old PC (http://66.32.187.134). Where could I host this site & and do you think this site would be helpful to the advancement of Python programming knowledge? Thanks. Father Jack  * How do I publish Python modules?
  .
  See [[PublishingPythonModules|PublishingPythonModules]] - [[Philip|Philip]], 2005-09-19
Line 53: Line 103:
  * Father Jack, you should look at the ["PythonHosting"] page and consider some of the options presented there. Your site doesn't seem to be available, so it's hard to assess what its contribution to Python programming knowledge might be. -- PaulBoddie   [[lwickjr|lwickjr]]: My question, "my" page. I created that page, empty, in hopes that someone would populate it. They have, and I've read it. They hadn`t yet when I created *this* page for posting how-to questions, at about the same time, so I included the question here in the seed page. See the attachments to [[lwickjr|my page]] for my final solution to the problem. ;) By the way, "How to publish Python modules" has been renamed "[[PublishingPythonModules|PublishingPythonModules]]", to be more Wiki-style. [Me, again.] 2005-11-24.


 * i got winxp. i make a simple program like print "hello". i save it as whatever.py. then i double-click it. nothing happens just the windows cmd appears for a blink. Additionally you can go to Start -> Run, type 'cmd', and hit enter. Now cd to your foo.py file, and execute it.
  . The Windows command window appears "for a blink" to show the output ("hello") before going away again - your program ends and the window closes. You can, of course, run the program from the command window (type "python whatever.py") to see the output, or you could make the program pause (using time.sleep) or wait for input (raw_input) before finishing - that would at least leave the command window open. Some operating systems leave command windows open after the program has finished, by the way.

 * This is an actual question. I have have a prototype for a python related website. Right now I am just running it off old PC ([[http://66.32.187.134/|http://66.32.187.134]]). Where could I host this site & and do you think this site would be helpful to the advancement of Python programming knowledge? Thanks. Father Jack
  * Father Jack, you should look at the [[PythonHosting|PythonHosting]] page and consider some of the options presented there. Your site doesn't seem to be available, so it's hard to assess what its contribution to Python programming knowledge might be. -- [[PaulBoddie|PaulBoddie]]
Line 56: Line 114:
  * Have you tried using the [[http://pyserial.sourceforge.net/pyparallel.html|pyParallel]] module? -- [[DavidBoddie|DavidBoddie]]
Line 57: Line 116:
  * Have you tried using the [http://pyserial.sourceforge.net/pyparallel.html pyParallel] module? -- DavidBoddie
Line 59: Line 117:
 *["I wish to generate graphics and images directly into a file, but I'm confused as to just what i need to do this with python"]  * I was browsing the Python source code, trying to find out how str.strip() is implemented as a string method. I found string.py in the Lib directory, but that didn't seem to hold the answer. Could you please help me learn where to look?
  .
  Take a look in the `Objects` directory for built-in types. The `stringobject.c` file contains the implementations of string methods, and the `string_strip` function should provide some details of the underlying functions used to provide the `strip` method's functionality.
Line 61: Line 121:
 *["How can I run an untrusted Python script safely (i.e. Sandbox)"]
Line 63: Line 122:
 * ["Socket module changed in Python 2.5?"]
Line 65: Line 123:
 *[wiki:Self:CanPythonIntrospectLikeJava "I come from a java background. Java has an API that list all classes and their methods that come with Java. Is there anything like that in python?"]  * How (aside from reading gobs and gobs of source code) can I find out the asymptotic time behaviour of various primitive Python operations? For example, for list xs, does xs.append(x) take amortized O(1) time or O(n) time?
  * Perhaps the [[TimeComplexity|Time Complexity]] page might offer some indications. -- [[PaulBoddie|PaulBoddie]] 2011-03-26 23:34:53
Line 67: Line 126:
 *[wiki:Self:HowDoYouProtectSource "How can I truly "protect" the python source code we create for a commercial product?"]
Line 69: Line 127:
 *[wiki:Self:DoesTinyPythonExist "Where can I find a tiny python installation (under 2 MB) for an embedded linux system?"]  * I'm trying to build matplotlib-1.0.1 from the source, and I keep getting error: command gcc-4.2 failed with error status one. Any ideas?
  * You might have to give a few more details including the circumstances and exact error message. Feel free to create a page showing the details using the "Add a page for a question" form at the top of this Wiki page. Alternatively, you may get better support by contacting the matplotlib developers directly, probably using one of the mailing lists. See the [[http://matplotlib.sourceforge.net/|matplotlib]] site for details of the different help options (currently listed under the "Need help?" sidebar). -- [[PaulBoddie|PaulBoddie]] 2012-07-12 14:09:20
Line 71: Line 130:
 * [wiki:Self:LocalVariablesInFunctions "How do I use local variables in a function within a class? (I do not want to use self.x, as this makes the instance have variables. I want variables local to my function, that get destroyed at the end of it.) I can only think of using del at the end of the function, is there a better way?"]




== Answered Longer Questions ==


Pages containing ''answered'' longer questions should appear in this list:



 1. [[Asking for Help/'break' outside loop?highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/'break' outside loop]]
 1. [[Asking for Help/Can Python introspect like Java??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/Can Python introspect like Java?]]
 1. [[Asking for Help/Defining rules for adding two different data types.?highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/Defining rules for adding two different data types.]]
 1. [[Asking for Help/Do you need a int main() like you do in c++?highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/Do you need a int main() like you do in c++]]
 1. [[Asking for Help/Gui Toolkit for python 3??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/Gui Toolkit for python 3?]]
 1. [[Asking for Help/How can "normal" users report bugs in Python or the documentation??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/How can "normal" users report bugs in Python or the documentation?]]
 1. [[Asking for Help/How can I add or substract two to the last digit of a float??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/How can I add or substract two to the last digit of a float?]]
 1. [[Asking for Help/How can I convert a hex representation to an integer??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/How can I convert a hex representation to an integer?]]
 1. [[Asking for Help/How can I import a module from a sibling directory??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/How can I import a module from a sibling directory?]]
 1. [[Asking for Help/How can I run an untrusted Python script safely (i.e. Sandbox)?highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/How can I run an untrusted Python script safely (i.e. Sandbox)]]
 1. [[Asking for Help/How can I split a string, but without breaking the quotes??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/How can I split a string, but without breaking the quotes?]]
 1. [[Asking for Help/How can i fetch system generated value from database after inserting a row using cursor.execute() function??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/How can i fetch system generated value from database after inserting a row using cursor.execute() function?]]
 1. [[Asking for Help/How come when I double click on a .py a black thing flashes and then disappears? And what/where exactly is the 'Python Interpreter'??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/How come when I double click on a .py a black thing flashes and then disappears? And what/where exactly is the 'Python Interpreter'?]]
 1. [[Asking for Help/How do I get or set the modification date of a file??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/How do I get or set the modification date of a file?]]
 1. [[Asking for Help/How do I run Python based software from SourceForge??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/How do I run Python based software from SourceForge?]]
 1. [[Asking for Help/How do I start a WSGI-compliant web-app on hired web space??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/How do I start a WSGI-compliant web-app on hired web space?]]
 1. [[Asking for Help/How do I use gzip module with pickle??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/How do I use gzip module with pickle?]]
 1. [[Asking for Help/How do I use local variables in methods??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/How do I use local variables in methods?]]
 1. [[Asking for Help/How do you protect Python source code??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/How do you protect Python source code?]]
 1. [[Asking for Help/How does the value from input() become a number, not a string? In 3.2??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/How does the value from input() become a number, not a string? In 3.2?]]
 1. [[Asking for Help/How to have a mutable buffer with python 2.3??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/How to have a mutable buffer with python 2.3?]]
 1. [[Asking for Help/How to run python from HTML?highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/How to run python from HTML]]
 1. [[Asking for Help/How to store information in variable arrays??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/How to store information in variable arrays?]]
 1. [[Asking for Help/I wish to generate graphics and images directly into a file, but I'm confused as to just what i need to do this with python?highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/I wish to generate graphics and images directly into a file, but I'm confused as to just what i need to do this with python]]
 1. [[Asking for Help/I'm attempting to run a program in pylab and pylab can't find the directory?highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/I'm attempting to run a program in pylab and pylab can't find the directory]]
 1. [[Asking for Help/I'm taking an unhandled threading exception that I've been unable to locate?highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/I'm taking an unhandled threading exception that I've been unable to locate]]
 1. [[Asking for Help/Is it possible to make a python window "click-through-able" (meaning mouseclicks will carry over to the window beneath it), and if so how??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/Is it possible to make a python window "click-through-able" (meaning mouseclicks will carry over to the window beneath it), and if so how?]]
 1. [[Asking for Help/Is there a way to create a file object from text without touching the file system??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/Is there a way to create a file object from text without touching the file system?]]
 1. [[Asking for Help/PythonFramework-x.x.pkg installation fails. Is there a workaround??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/PythonFramework-x.x.pkg installation fails. Is there a workaround?]]
 1. [[Asking for Help/Slow SYBASE query after version upgrade?highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/Slow SYBASE query after version upgrade]]
 1. [[Asking for Help/Socket module changed in Python 2.5??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/Socket module changed in Python 2.5?]]
 1. [[Asking for Help/Stop 'Hello World' from flashing?highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/Stop 'Hello World' from flashing]]
 1. [[Asking for Help/SubtractionQuestion?highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/SubtractionQuestion]]
 1. [[Asking for Help/Where can I find a tiny python installation (under 2 MB) for an embedded linux system??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/Where can I find a tiny python installation (under 2 MB) for an embedded linux system?]]
 1. [[Asking for Help/Why does IDLE refuse to start on Windows??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/Why does IDLE refuse to start on Windows?]]
 1. [[Asking for Help/Why don't my list and generator comprehensions work??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/Why don't my list and generator comprehensions work?]]
 1. [[Asking for Help/Why is my global not assigned??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/Why is my global not assigned?]]
 1. [[Asking for Help/Why when I read a text file python reads it as "<built-in method read of _io.TextIOWrapper object at 0x02954558>" and how do I stop this??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/Why when I read a text file python reads it as "<built-in method read of _io.TextIOWrapper object at 0x02954558>" and how do I stop this?]]
 1. [[Asking for Help/readline under MS?highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/readline under MS]]
 1. [[Asking for Help/visual error message?highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/visual error message]]
 1. [[Asking for Help/what and how we can use server in python web development ??highlight=(\bCategoryAskingForHelpAnswered\b)|Asking for Help/what and how we can use server in python web development ?]]


Questions appear here when they are added to the [[CategoryAskingForHelpAnswered|CategoryAskingForHelpAnswered]] category (having been answered).
Line 74: Line 188:
CategoryFaq
[[
CategoryFaq|CategoryFaq]]

Asking for Help

The most efficient way of getting help is via the various mailing lists and newsgroups, particularly the comp.lang.python newsgroup.

See the Community page for a selection of related resources.

For those of you willing to wait, and to add to the archive of problems (and solutions), enter your question in the list below. For longer questions, consider adding a new page using the button just below: write a short version of the question in the box - this will be the page name - and then write the actual question or problem description in the page editor that appears after pressing the button.

The page will be automatically added to the longer questions section below.

Questions

  • ssl-1.14.tar.gz exists and supposedly works with Python 2.5x. Assuming I have Visual Studio .NET 2003 available on my box, how do I build the package for Windows. It currently complains about a series of openssl *.h files that aren't available. I can drag in openssl for www.openssl.org, but which version, if that is applicable, and how do I connect the two either in a directory structure or appropriate configuration files?
  • I'm working with embedding Python into my applications. However, the Py_Initialize() is producing an " 'import site' failed " message on non-dev computers. I was wondering if there is a way to fix this or is it just a bug with Python? Thank you.
  • I'm trying to run the IDLE but it wont go on. i have an R52 leptop with ibm-tools installed (there is ver 2.2 there but i changed it so it wont ebe the default one). im trying to run ver 2.6. Thank
  • I'm new to python and I am just working with the idle-shell. How can I write a script without having python executing orders immediately after I type them into the shell? Follow-Up question: Having written the script, how do I run it in the interpreter?
  • I just installed MacPython. Unfortunately it doesn't seem to include the CoreGraphics-Python Module. Where ist my old system python? How can I uninstall MacPython?

  • Is there any way to get the environment from a subprocess.Popen created by python? In other words, if the new process updates it's environment, is it possible to get access to the modifications. For example In my case I'm executing MS Visual Studio's vsvars32.bat file and would like to access the modified PATH environment variable.
  • Is there any way to determine if the C implementation under my Python uses IEEE 754 for floating point numbers? If yes, what is it?
  • I am trying to run Python script in ABAQUS, but there is a error "Import Error: No Module named " Tkinter"". So how can I handle the problem? Thanks
  • Why do I call constructor of Cmd class in my Cmd subclass __init__ method?

  • When I import Tkinter, Python exits. Why?

  • I am new at python, I have python 2.5 and every time i open the shell python resets my moniter to 800x600. How do I keep python from messing with my monitor settings? -Travis

Longer Questions

Pages containing longer questions should appear in this list:

  1. Asking for Help/How delete files in the GUI

  2. Asking for Help/How do you create tables in Python?

  3. Asking for Help/How to solve problem when running python from command line?

  4. Asking for Help/How to use Python with MySQL on Windows

  5. Asking for Help/How to use Reg. Exp. to capture data from random text

  6. Asking for Help/How to utilize SQL Server stored procedure that accepts table valued parameter

  7. Asking for Help/I am trying to run Python on IDLE in Windows. Why doesn't IDLE close old pythonw processes on restarting the shell or even quitting IDLE?

  8. Asking for Help/I don't see a 'run' option in the toolbar of Python 3

  9. Asking for Help/I tried to port python 2.7 to iOS and got "Fatal Python error: exceptions bootstrapping error.". How can I fix it?

  10. Asking for Help/I want to right-click on data files in Windows XP and open them with a Python program.

  11. Asking for Help/Installation Errors

  12. Asking for Help/Is there a way to use i instead of j for complex numbers?

  13. Asking for Help/Python ISO-8859-1 encoding problem

  14. Asking for Help/Python,Pydev and the terminal in linux.

  15. Asking for Help/Using Python with native DB2 drivers

  16. Asking for Help/What is wrong with this "game of life" program?

  17. Asking for Help/What's the simplest way to connect to a MSSQL database via Python v3? I'm trying sqlite3, but I think I'm barking up the wrong tree...

  18. Asking for Help/Why do I get permission denied errors when using macostools.copy?

  19. Asking for Help/Why do I see b'string' when i print a c_char_p string?

  20. Asking for Help/does a python blink

  21. Asking for Help/exiting idle

  22. Asking for Help/remove escape characters

  23. Asking for Help/remove write protected file forcefully like "rm -f"

  24. Asking for Help/thread started using 'bg' ends without any notification

  25. Asking for Help/with newton force calculator

These questions will be moved to the answered longer questions section below when they are answered (having been added to the CategoryAskingForHelpAnswered category).

Answered (fully or partially)

  • How do I write multi-line strings in doctest tests?

  • Related question to the for-a-blink question in the answered section. When running os.system(some command) the CMD.exe window pops up and then terminates when the process terminates. How do I get the contents of what was in that CMD.exe window saved someplace - variable, file, etc. Variable assignment doesn't work - only the exit code is in the variable.

    • Seems to me you need to redirect the stdout. As per Python Library Reference 6.1.5., this is impossible for os.system() calls.
  • Does anyone know why msOffice products (using win32com return) u'dana\u2019s best' rather than u'dana's best'?
    • Microsoft Office replaces apostrophes (U+0027) with "Right Single Quotation Marks" (U+2019) automatically. While this looks correct typograpphically, it might cause some problems. -- IanBollinger

  • I'm a total Python newbie. How do I get Python started on a Palm handheld ( http://c2.com/cgi/wiki?PalmPython ) ? Or should I focus on learning Python on a desktop PC first ? -- DavidCary

    • I would recommend learning Python on a normal desktop system, with a recent version, a full suite of libraries, and IPython (Interactive Python) installed. After you've learned the basics then you can probably adapt more readily to the limitations of the Palm Pilot interface, implementation, version (older), and libraries (reduced subset). JimD

  • How do you save python code and use it for anything? --elpenmaster
    • Save it as "scriptName.py" and then execute it with the Python interpreter. As for choosing a purpose for the code, that's entirely up to you. -- PeytonMcCullough

      • How do I save it as scriptname.py? --elpenmaster
        • - it is possible to enter python commands into a text file, rather than entering them directly into the python shell. Simply create a text file containing your python instructions and save it as scriptname.py, you can then import it into a python shell session or execute it directly.
  • TestHarnessDesign -- I've been assigned the task of designing a test harness for embedded systems, servers and software. -- JimD

  • How do I publish Python modules?
    • See PublishingPythonModules - Philip, 2005-09-19

      lwickjr: My question, "my" page. I created that page, empty, in hopes that someone would populate it. They have, and I've read it. They hadn`t yet when I created *this* page for posting how-to questions, at about the same time, so I included the question here in the seed page. See the attachments to my page for my final solution to the problem. ;) By the way, "How to publish Python modules" has been renamed "PublishingPythonModules", to be more Wiki-style. [Me, again.] 2005-11-24.

  • i got winxp. i make a simple program like print "hello". i save it as whatever.py. then i double-click it. nothing happens just the windows cmd appears for a blink. Additionally you can go to Start -> Run, type 'cmd', and hit enter. Now cd to your foo.py file, and execute it.

    • The Windows command window appears "for a blink" to show the output ("hello") before going away again - your program ends and the window closes. You can, of course, run the program from the command window (type "python whatever.py") to see the output, or you could make the program pause (using time.sleep) or wait for input (raw_input) before finishing - that would at least leave the command window open. Some operating systems leave command windows open after the program has finished, by the way.
  • This is an actual question. I have have a prototype for a python related website. Right now I am just running it off old PC (http://66.32.187.134). Where could I host this site & and do you think this site would be helpful to the advancement of Python programming knowledge? Thanks. Father Jack

    • Father Jack, you should look at the PythonHosting page and consider some of the options presented there. Your site doesn't seem to be available, so it's hard to assess what its contribution to Python programming knowledge might be. -- PaulBoddie

  • How can I programming the io ports (eg.: LPT) with Python?
  • I was browsing the Python source code, trying to find out how str.strip() is implemented as a string method. I found string.py in the Lib directory, but that didn't seem to hold the answer. Could you please help me learn where to look?
    • Take a look in the Objects directory for built-in types. The stringobject.c file contains the implementations of string methods, and the string_strip function should provide some details of the underlying functions used to provide the strip method's functionality.

  • How (aside from reading gobs and gobs of source code) can I find out the asymptotic time behaviour of various primitive Python operations? For example, for list xs, does xs.append(x) take amortized O(1) time or O(n) time?
  • I'm trying to build matplotlib-1.0.1 from the source, and I keep getting error: command gcc-4.2 failed with error status one. Any ideas?
    • You might have to give a few more details including the circumstances and exact error message. Feel free to create a page showing the details using the "Add a page for a question" form at the top of this Wiki page. Alternatively, you may get better support by contacting the matplotlib developers directly, probably using one of the mailing lists. See the matplotlib site for details of the different help options (currently listed under the "Need help?" sidebar). -- PaulBoddie 2012-07-12 14:09:20

Answered Longer Questions

Pages containing answered longer questions should appear in this list:

  1. Asking for Help/'break' outside loop

  2. Asking for Help/Can Python introspect like Java?

  3. Asking for Help/Defining rules for adding two different data types.

  4. Asking for Help/Do you need a int main() like you do in c++

  5. Asking for Help/Gui Toolkit for python 3?

  6. Asking for Help/How can "normal" users report bugs in Python or the documentation?

  7. Asking for Help/How can I add or substract two to the last digit of a float?

  8. Asking for Help/How can I convert a hex representation to an integer?

  9. Asking for Help/How can I import a module from a sibling directory?

  10. Asking for Help/How can I run an untrusted Python script safely (i.e. Sandbox)

  11. Asking for Help/How can I split a string, but without breaking the quotes?

  12. Asking for Help/How can i fetch system generated value from database after inserting a row using cursor.execute() function?

  13. Asking for Help/How come when I double click on a .py a black thing flashes and then disappears? And what/where exactly is the 'Python Interpreter'?

  14. Asking for Help/How do I get or set the modification date of a file?

  15. Asking for Help/How do I run Python based software from SourceForge?

  16. Asking for Help/How do I start a WSGI-compliant web-app on hired web space?

  17. Asking for Help/How do I use gzip module with pickle?

  18. Asking for Help/How do I use local variables in methods?

  19. Asking for Help/How do you protect Python source code?

  20. Asking for Help/How does the value from input() become a number, not a string? In 3.2?

  21. Asking for Help/How to have a mutable buffer with python 2.3?

  22. Asking for Help/How to run python from HTML

  23. Asking for Help/How to store information in variable arrays?

  24. Asking for Help/I wish to generate graphics and images directly into a file, but I'm confused as to just what i need to do this with python

  25. Asking for Help/I'm attempting to run a program in pylab and pylab can't find the directory

  26. Asking for Help/I'm taking an unhandled threading exception that I've been unable to locate

  27. Asking for Help/Is it possible to make a python window "click-through-able" (meaning mouseclicks will carry over to the window beneath it), and if so how?

  28. Asking for Help/Is there a way to create a file object from text without touching the file system?

  29. Asking for Help/PythonFramework-x.x.pkg installation fails. Is there a workaround?

  30. Asking for Help/Slow SYBASE query after version upgrade

  31. Asking for Help/Socket module changed in Python 2.5?

  32. Asking for Help/Stop 'Hello World' from flashing

  33. Asking for Help/SubtractionQuestion

  34. Asking for Help/Where can I find a tiny python installation (under 2 MB) for an embedded linux system?

  35. Asking for Help/Why does IDLE refuse to start on Windows?

  36. Asking for Help/Why don't my list and generator comprehensions work?

  37. Asking for Help/Why is my global not assigned?

  38. Asking for Help/Why when I read a text file python reads it as "<built-in method read of _io.TextIOWrapper object at 0x02954558>" and how do I stop this?

  39. Asking for Help/readline under MS

  40. Asking for Help/visual error message

  41. Asking for Help/what and how we can use server in python web development ?

Questions appear here when they are added to the CategoryAskingForHelpAnswered category (having been answered).


CategoryFaq

Asking for Help (last edited 2019-11-04 14:47:35 by ChrisM)

Unable to edit the page? See the FrontPage for instructions.