Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Re Python Function
#1
Hey I have a question that what function do I need to use to run the python script without specifying path name, but by giving only python 'filename'(Image filename)to generate output?
Reply
#2
That sounds like an import, which is a statement, not a function. There is an __import__ function which can import a module, but that is not recommended for typical use. Instead, importlib.import_module is recommended.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#3
Here is the original code which looks like: Please help me out in getting solution

import tensorflow as tf
import sys
print (sys.argv)



# change this as you see fit
image_path = 'shop_418866_job_11608003_picture_1737331_disc_2.jpg'

# Read in the image_data
image_data = tf.gfile.FastGFile(image_path, 'rb').read()
Reply
#4
I don't understand the problem you are trying to solve. What exactly is the problem you are having with that code? If you are getting an error, please give the full error text (the traceback). If the output is not what it should be, clearly explain how it is wrong.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#5
I was trying for a statement or function which help to generate output by giving image path (image_path = 'shop_418866_job_11608003_picture_1737331_disc_2.jpg) as input instead of giving full file path. Kindly help me out. Thanks
Reply
#6
I don't think that's a good idea. You could use the glob function from the glob module to find all files with that name, but that would be searching the whole file system.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Forum Jump:

User Panel Messages

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