Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: code
Post: RE: code

Please note that the use of the following syntax is a recipe for disaster: random = random.randint(1,3)The module 'random' is now overwritten and is a local variable of type 'int' The following examp...
ljmetzger General Coding Help 2 2,808 Jul-09-2018, 12:38 PM
    Thread: investigating a bash error
Post: RE: investigating a bash error

Quote:Do you know what the syntax name to help with understanding how to read the output from that? (as a debugging tool for future use) Each individual item in the path is separated by a colon ':'. ...
ljmetzger General Coding Help 7 4,053 Jul-04-2018, 08:48 PM
    Thread: EOFError: Ran Out Of Input in Pickle
Post: RE: EOFError: Ran Out Of Input in Pickle

Your error is typical of pickle file savek.p that exists, but is empty. When I replace the actual pickle file contents with the following text: Output:xxx yyy zzzthe following Traceback error occurs...
ljmetzger General Coding Help 2 48,711 Jul-04-2018, 08:02 PM
    Thread: investigating a bash error
Post: RE: investigating a bash error

I am not a Linux user, but two things come to mind: a. Are you actually acesssing twphotos? Try /Users/local/Library/Python/2.7/bin/twphotos or navigate to the directory and execute twphotos. b. Verif...
ljmetzger General Coding Help 7 4,053 Jul-04-2018, 07:25 PM
    Thread: VSCode want to change to terminal window.
Post: RE: VSCode want to change to terminal window.

Probably not what you are looking for, but if you: a. 'Left Click' the Debug Symbol on the left Margin, then b. 'Left Click' the 'Green Triangle' VS code runs in Debug Mode (takes longer), but the cur...
ljmetzger Bar 4 3,372 Jul-03-2018, 11:57 PM
    Thread: Why didn't my installation of pygame work?
Post: RE: Why didn't my installation of pygame work?

If you have Python 3.6 or older the following runstring should work (which downloads from PyPI): pip install pygame I get similar errors using Python 3.7 on Windows 10. I was successful downloading ...
ljmetzger Game Development 4 4,514 Jul-01-2018, 05:40 PM
    Thread: Py2exe down
Post: RE: Py2exe down

To test, try http://www.isitdownrightnow.com/py2exe.net.html It seems like the website is down. Lewis
ljmetzger Bar 8 4,959 Jul-01-2018, 05:21 PM
    Thread: syntax help
Post: RE: syntax help

The example code that @buran posted from the URL you provided has several syntax errors and several logic errors. Your first job is to get the code to compile without any errors or warnings with as f...
ljmetzger General Coding Help 3 2,863 Jul-01-2018, 03:51 PM
    Thread: END in file after f.write ?!
Post: RE: END in file after f.write ?!

I am assuming gphoto2 is the contents of your file, which I simulated using a string. I converted the contents of the string into a dictionary, using a colon : as the parse character. I am relativel...
ljmetzger General Coding Help 4 2,972 Jul-01-2018, 02:49 PM
    Thread: END in file after f.write ?!
Post: RE: END in file after f.write ?!

My speculation is that '\nEND' is part of one of your variables since you provided incomplete code. See the following code example: # write log entry output = "uuuuu" f = open("aaa.txt","a") f.write(...
ljmetzger General Coding Help 4 2,972 Jun-30-2018, 11:42 PM
    Thread: Passing a list by reference
Post: RE: Passing a list by reference

Traditional language call by value and call by reference take a backseat in Python to call by object reference. In addition to @volcano63's excellent comments, see the following which discusses all t...
ljmetzger General Coding Help 6 4,581 Jun-30-2018, 08:12 PM
    Thread: How to round this code without getting an error?
Post: RE: How to round this code without getting an erro...

Please note that both your examples do not run. They both need an extra ) at the end of the print statement (line 9) to run. After correcting the error, your code works, but does not print two decim...
ljmetzger Homework 2 2,450 Jun-30-2018, 07:57 PM
    Thread: Shared reference and equality
Post: RE: Shared reference and equality

Like @volcano63 said, is tests if two variables point to the same object. To check if values are the same use ==. In the example below mylist1 and mylist2 point to the same object. mylist3 is a cop...
ljmetzger General Coding Help 3 3,217 Jun-30-2018, 07:10 PM
    Thread: Syntax error in if statement
Post: RE: Syntax error in if statement

Another simpler method uses the datetime library which comes with python. Reference: https://docs.python.org/3/library/datetime.html import datetime mynow = datetime.datetime.now() print("mynow = {}"....
ljmetzger General Coding Help 4 2,981 Jun-26-2018, 06:48 PM
    Thread: c as parameter
Post: RE: c as parameter

Try adding a space before the c. It is not PEP-8 compliant but eliminates the little c. def f( c): #NOTE: Space added before the 'c' due to Bulletin Board limitations (space should not be there)...
ljmetzger Board 10 6,542 Jun-26-2018, 06:08 PM
    Thread: Syntax error in if statement
Post: RE: Syntax error in if statement

Try syntax like the following in Python 3: import time timeh = int(time.ctime()[11:13]) print("timeh = {:05b}".format(timeh)) x = 2 print("x = {:05b}".format(x)) x = 24 print("x = {:05b}".format(x))O...
ljmetzger General Coding Help 4 2,981 Jun-25-2018, 04:28 PM
    Thread: cryptographic error
Post: RE: cryptographic error

Since the application was working before, you seem to have some kind of configuration problem. Please note that the PYPI version of pyopenssl was updated to 18.0 on May 16, 2008. Again using Python...
ljmetzger General Coding Help 7 8,901 Jun-25-2018, 12:55 PM
    Thread: Wrap from end to beginning. 27 to 1, 28 to 2 etc
Post: RE: Wrap from end to beginning. 27 to 1, 28 to 2 e...

Good job. Take a look at the following code, and write finish the decryption algorithm: NOTES and suggestions: a. Make variables local if possible - i.e. avoid globals b. Pass items to functions as ...
ljmetzger General Coding Help 5 3,736 Jun-24-2018, 01:02 PM
    Thread: what is the name?
Post: RE: what is the name?

(Jun-24-2018, 02:07 AM)Skaperen Wrote: does anyone know the name of the coding scheme that lets your carriage returns be known as ^M or \r and your tabs be known as ^I or \t ... From my ASR 33 days,...
ljmetzger Bar 9 4,825 Jun-24-2018, 10:59 AM
    Thread: cryptographic error
Post: RE: cryptographic error

@Lars60+ excellent links. Please note that OP is using Linux and Python 2.7. There have been numerous cases where ImportError: cannot import name certificate_transparency have been reported, and ma...
ljmetzger General Coding Help 7 8,901 Jun-24-2018, 10:02 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020