Differences between revisions 9 and 97 (spanning 88 versions)
Revision 9 as of 2004-10-02 13:18:29
Size: 726
Editor: h134-215-201-101
Comment:
Revision 97 as of 2008-07-19 15:27:00
Size: 7977
Editor: e179000236
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
This page was created as a place for people to ask questions. It is intended that the question be the WikiName of the page containing the answer. As answers are provided, this will develop naturaly into a FAQ Answers page. See Also: ["Asking for Help/Why doesn`t this work?"]
  * Hi, 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?
Line 3: Line 4:
See also ["Where can I find..."]   * Hi, I am new to Python from Java background, I have following structure
    {{{
/root
 /folder1
  Class1.py
  Class2.py
 /folder2
  Class3.py
}}}
Line 5: Line 14:
["How do I publish Python modules?"]     I am in the folder2 and want to run class3.py but it need to import a module from Class1.py
    Could someone please help me?
  * I believe you just need to add folder1 to your path variable. Should be something along the lines of: import sys; sys.path.append('/root/folder1'); import Class1 (with ; replaced by newlines). If that doesn't work, look through the documentation for info on how the sys.path variable works--I may just have the syntax slightly off
Line 7: Line 18:
["When I import Tkinter, Python exits. Why?"]   * 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.
 
 * ["I want to right-click on data files in Windows XP and open them with a Python program."]
Line 9: Line 22:
["How can "normal" users report bugs in Python or the documentation?"]  * 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?
Line 11: Line 24:
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  * 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
 *["How to store information in variable arrays?"]

 *["Why do I call conctructor of Cmd class in my Cmd subclass __init__ method?"]

 *["How to run Python based softwares from sourceforge? !!!Newbie"]

 *["How to use Python with MySQL on Windows"]

 *["Why do I get permission denied errors when using macostools.copy"]

 *["When I import Tkinter, Python exits. Why?"]

== Answered (fully or partially) ==
 *["How to have a mutable buffer with python 2.3?"]

 *[:MultiLineStringsInDocTest:How do I write multi-line strings in doctest tests?]

 *["How do I get / set the modification date of a file?"]

 *["How do I use gzip module with pickle?"]

 *["How can "normal" users report bugs in Python or the documentation?"]

 *["How can I convert a hex representation to an integer?"]

 *SubtractionQuestion

 * 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 [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"]

 * 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 [: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.

 *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?

  * Have you tried using the [http://pyserial.sourceforge.net/pyparallel.html pyParallel] module? -- DavidBoddie

 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

 *["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"]

 *["How can I run an untrusted Python script safely (i.e. Sandbox)"]

 * ["Socket module changed in Python 2.5?"]

 *[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?"]

 *[wiki:Self:HowDoYouProtectSource "How can I truly "protect" the python source code we create for a commercial product?"]

 *[wiki:Self:DoesTinyPythonExist "Where can I find a tiny python installation (under 2 MB) for an embedded linux system?"]

 * [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?"]


 * ["PythonFramework-x.x.pkg installation fails. Is there a workaround?"]
----
CategoryFaq

See Also: ["Asking for Help/Why doesn`t this work?"]

  • Hi, 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?

  • Hi, I am new to Python from Java background, I have following structure
    • /root
              /folder1
                      Class1.py
                      Class2.py
              /folder2
                      Class3.py
      I am in the folder2 and want to run class3.py but it need to import a module from Class1.py Could someone please help me?
  • I believe you just need to add folder1 to your path variable. Should be something along the lines of: import sys; sys.path.append('/root/folder1'); import Class1 (with ; replaced by newlines). If that doesn't work, look through the documentation for info on how the sys.path variable works--I may just have the syntax slightly off
  • 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.
  • ["I want to right-click on data files in Windows XP and open them with a Python program."]
  • 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
  • ["How to store information in variable arrays?"]
  • ["Why do I call conctructor of Cmd class in my Cmd subclass init method?"]

  • ["How to run Python based softwares from sourceforge? !!!Newbie"]
  • ["How to use Python with MySQL on Windows"]
  • ["Why do I get permission denied errors when using macostools.copy"]
  • ["When I import Tkinter, Python exits. Why?"]

Answered (fully or partially)

  • ["How to have a mutable buffer with python 2.3?"]
  • [:MultiLineStringsInDocTest:How do I write multi-line strings in doctest tests?]

  • ["How do I get / set the modification date of a file?"]
  • ["How do I use gzip module with pickle?"]
  • ["How can "normal" users report bugs in Python or the documentation?"]
  • ["How can I convert a hex representation to an integer?"]
  • SubtractionQuestion

  • 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 [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"]

  • 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 [: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.

  • 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 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
  • ["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"]
  • ["How can I run an untrusted Python script safely (i.e. Sandbox)"]
  • ["Socket module changed in Python 2.5?"]
  • [wiki: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?"]

  • [wiki:HowDoYouProtectSource "How can I truly "protect" the python source code we create for a commercial product?"]

  • [wiki:DoesTinyPythonExist "Where can I find a tiny python installation (under 2 MB) for an embedded linux system?"]

  • [wiki: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?"]

  • ["PythonFramework-x.x.pkg installation fails. Is there a workaround?"]


CategoryFaq

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

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